Benefits of "Use Strict" in JS [duplicate]
Solution 1:
There are a zillion benefits to strict mode, but since you asked specifically about performance, not just the good coding benefits, here's what MDN says about that:
Strict mode makes several changes to normal JavaScript semantics. First, strict mode eliminates some JavaScript silent errors by changing them to throw errors. Second, strict mode fixes mistakes that make it difficult for JavaScript engines to perform optimizations: strict mode code can sometimes be made to run faster than identical code that's not strict mode. Third, strict mode prohibits some syntax likely to be defined in future versions of ECMAScript.
So as you asked, according to the Firefox folks at MDN, strict mode code can sometimes run faster.
For general benefits of strict mode, see What does "use strict" do in JavaScript, and what is the reasoning behind it?
Solution 2:
Here are the benefits :)
- Duplicate keys in object.
- Variables without var
- Duplicate arguments
- Freezes the arguments of the functions
See a better explanation of Use strict in JavaScript here.