For Strict mode, we using use strict to execute
The purpose of use strict is to indicate that the code should be executed in "strict mode".
Strict mode makes it easier to write "secure" JavaScript.
Strict mode changes previously accepted "bad syntax" into real errors.
Strict mode is declared by adding use strict to the beginning of a JavaScript file, or a JavaScript function.
Declared at the beginning of a JavaScript file, it has global scope (all code will execute in strict mode).
Declared inside a function, it has local scope (only the code inside the function is in strict mode).
Example:
"use strict";
function testStrict(){
var x;
x = 5; // This does not cause an error.
}
x = 5; // This causes an error