Google News
logo
Full Stack Developer - Interview Questions
What are the Advantages and Disadvantages of Using "use strict"?
"use strict" is a statement that is used to enable strict mode to entire scripts or individual functions. Strict mode is a way to opt in to a restricted variant of JavaScript.
 
Advantages :
 
* It makes it impossible to create global variables by mistake.
* Makes assignments that would otherwise silently fail to throw an exception.
* Makes attempts to delete undeletable properties throw (where before the attempt would simply have no effect).
* It is mandatory that the function parameter name should be unique.
* this is undefined in the global context.
* It catches some common coding bloopers, throwing exceptions.
* It stops the functioning of features that are confusing.

Disadvantages :
 
* A lot of features that most of the developers might be used to are absent.
* No more access to function.caller and function.arguments.
* The concatenation of scripts written in different strict modes might cause issues.
Advertisement