Firefox: SyntaxError: "use strict" not allowed in function with default parameter SyntaxError: "use strict" not allowed in function with rest parameter SyntaxError: "use strict" not allowed in function with destructuring parameter Chrome: SyntaxError: Illegal 'use strict' directive in function with non-simple parameter listError type 무ìì´ ì못 ëììê¹ì?
"use strict"
ì§ì문ì ë¤ì 매ê°ë³ì ì¤ í ê°ê° ìë í¨ìì 맨 ìì ìì±ë©ëë¤:
"use strict"
ì§ì문ì ECMAScript ëìì ë°ë¼ ì´ë¬í í¨ìì 맨 ìì íì©ëì§ ììµëë¤.
ë¤ìì í¨ì sum
ìë 기본 ë§¤ê° ë³ì a=1
ë° b=2
ê° ìë ê²½ì°ì
ëë¤:
function sum(a = 1, b = 2) {
// SyntaxError: "use strict" not allowed in function with default parameter
'use strict';
return a + b;
}
í¨ìê° strict mode 모ëì ìì´ì¼ íê³ ì ì²´ ì¤í¬ë¦½í¸ ëë í¬í¨ë í¨ìê° strict modeì ìì´ë ê´ì°®ì¼ë©´ í¨ì ì¸ë¶ìì "use strict"
ì§ì문ì ì´ëí ì ììµëë¤:
"use strict";
function sum(a = 1, b = 2) {
return a + b;
}
í¨ì ííì
í¨ì ííìì ë ë¤ë¥¸ í´ê²°ë°©ë²ì ì¬ì©í ì ììµëë¤:
var sum = function sum([a, b]) {
// SyntaxError: "use strict" not allowed in function with destructuring parameter
'use strict';
return a + b;
};
ì´ê²ì ë¤ì ííìì¼ë¡ ë³í ë ì ììµëë¤:
var sum = (function () {
"use strict";
return function sum([a, b]) {
return a + b;
};
})();
íì´í í¨ì
íì´í í¨ìê° this
ì ì ê·¼í´ì¼ íë ê²½ì°ìë, ëë¬ì¼ í¨ìë¡ íì´í í¨ì를 ì¬ì©í ì ììµëë¤:
var callback = (...args) => {
// SyntaxError: "use strict" not allowed in function with rest parameter
'use strict';
return this.run(args);
};
ì´ê²ì ë¤ì ííìê³¼ ê°ì´ ë³íë ì ììµëë¤:
var callback = (() => {
"use strict";
return (...args) => {
return this.run(args);
};
})();
ê°ì´ 보기
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4