Strict mode - Vincentvanleeuwen/js-bootcamp GitHub Wiki
Strict mode
Strict mode is used to show more specific errors that JavaScript doesn't show by default.
'use strict'
It is also possible to only use strict mode in a certain scope, this is true for everything nested inside the scope, for example:
function scriptMode() {
'use strict';
console.log("This message is in strict mode!");
function nestedScriptMode() {
console.log("This is also in strict mode!");
}
}
console.log("This message is not in strict mode");
If you make a module, it is automatically set to strict mode.