Co jest „użyj ścisłego”
The statement "use strict"; instructs the browser to use the Strict mode, which is a reduced and safer feature set of JavaScript.
Himanshu Jangid
The statement "use strict"; instructs the browser to use the Strict mode, which is a reduced and safer feature set of JavaScript.
// Non-strict code...
(function(){
"use strict";
// Define your library strictly...
})();
// Non-strict code...
// File: myscript.js
'use strict';
var a = 2;
....
'use strict';
// Error
myVariable = 9;
function doSomething() {
'use strict';
...
}
"use strict";
myFunction();
function myFunction() {
y = 3.14; // This will also cause an error because y is not declared
}