“With great power comes great responsibility.” — Ben Parker
Syntax: In order to use strict mode in your script we just need to exercise the following line below, strict-mode also known as strict mode pragma has its own scope and can affect the whole file or individual methods depending on the same.
"use strict"; // Turn on strict mode. a = 1;
Uncaught ReferenceError: a is not defined
"use strict"; // Turn on strict mode. var a = 1; delete a;
Uncaught SyntaxError: Delete of an unqualified identifier in strict mode.
"use strict"; // Turn on strict mode. var eval = 5;
Uncaught SyntaxError: Unexpected eval or arguments in strict mode.
Uncaught SyntaxError: Duplicate parameter name not allowed in this context
To know more about Strict mode please go through this article
Please Login to comment...