"use strict" is a string that makes your program or function follow a strict operating context.
It means, the errors which were being ignored by the compiler, will now throw exception messages.
The purpose of "use strict" is to indicate that the code should be executed in "strict mode".
Advantage of using
The following are the three main advantage of using
- Prohibits some syntax likely to be defined in future versions of ECMAScript.
Initialize Undeclared Variable
In strict mode, you cannot initialize a value to undeclared variables.
The strict mode will throw an error when you are trying to delete a variable instead of deleting a property of an object.
Duplicating parameter name is not allowed in strict mode.
Octal literals are not allowed in strict mode.
Octal Escape Sequences
Octal escape sequences are not allowed in strict mode.
Read Only Object
Read only object properties are not allowed to change its value in strict mode.
eval() is not allowed to create variables in the scope under Strict Mode.
Please do google search for:
Join Our Channel
This channel is primarily useful for Full Stack Web Developer.