嚴謹模式

嚴謹模式 (Strict Mode)

“use strict”,必須要放在第一行

"use strict";
x = 3.14;
// Uncaught ReferenceError: x is not defined
"use strict";
myFunction();

function myFunction() {
    y = 3.14;
}

// Uncaught ReferenceError: y is not defined
x = 3.14;
myFunction();

function myFunction() {
   "use strict";
    y = 3.14;
}
// Uncaught ReferenceError: y is not defined

延伸閱讀

results for ""

    No results matching ""