Tag Archives: “use strict

What is “use strict”;? what are the advantages and disadvantages to using it?

What is “use strict”;? what are the advantages and disadvantages to using it?

This statement indicates that the code should be executed in “strict mode”. It is only declared at the beginning of a function/script.Strict mode will help save developers from errors they didn’t even know that existed in their code.

Advantages:
i) It will catch common coding errors, which will throw exceptions.
ii) When vulnerable actions are performed, it throws errors.
iii) It will show,let us know and disable the features that are poorly coded.

Disadvantages:
i) It will not allow us to use the “with” statement. This statement will causes security and performance problems.

ii) It will not allow us to use the “arguments.caller” property, due to security concernsWe do not have an alternate to this property, but we can hard code an additional parameter.