Description JavaScript es5 strict mode

es5 strict mode

Now the browser is es3.0 and some of the new approach based on the use of es5.0.

However, es3.0 and es5.0 conflicting part, then if es5.0 strict mode is enabled, then the part and es5.0 conflict es3.0 is to use es5.0, otherwise use es3.0 (also in general, not enabled by strict mode).

Today we explore the "conflict with section es5.0 (in strict mode) is how to solve?"

  • es5.0 strict mode is enabled:
    "use strict"; on the logic of the top.
    It should be noted that: "use strict"; can be written in a global, can also be written in function, and write where it plays a role in which area.

  • Strict mode can not be used:

1. with () {} error.

2.arguments.callee and function.caller can not be used in strict mode.

3. must be declared before the variable assignment.

4. The local this must be assigned, the process no longer point to the precompiled window.

5. Repeat property or parameter is being given to repeat.

6.eval ( "") es3.0 can not be used.

Published 49 original articles · won praise 30 · views 30000 +

Guess you like

Origin blog.csdn.net/Reagan_/article/details/81327523