In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the knowledge of "what is the strict mode of JavaScript". In the operation of actual cases, many people will encounter such a dilemma. Then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
JavaScript strict Mode (use strict):
JavaScript strict mode (strict mode) does not allow the use of undeclared variables.
Strict mode (strict mode) is running under strict conditions.
The "use strict" directive is added in JavaScript 1.8.5 (ECMAScript5).
It is not a statement, but a "literal expression".
The purpose of "use strict" is to specify that the code is executed under strict conditions.
You cannot use undeclared variables in strict mode.
Declare a local scope within the function (strict mode is used only within the function):
Why use strict mode? :
Eliminate some unreasonable and imprecise aspects of Javascript syntax and reduce some strange behaviors.
Eliminate some unsafe places where the code runs, and ensure the safety of the code running.
Improve the compiler efficiency and increase the running speed.
Lay the groundwork for future new versions of Javascript.
Http://www.iis7.com/b/plc/
"strict mode" reflects the more reasonable, secure and rigorous direction of Javascript. Mainstream browsers, including IE 10, have supported it, and many big projects have begun to embrace it in an all-round way.
On the other hand, the same code may have different results in "strict mode"; some statements that can be run in "normal mode" will not run in "strict mode". Mastering these contents will contribute to a more detailed and in-depth understanding of Javascript and make you a better programmer.
Strict mode limitations:
Undeclared variables are not allowed, and the object is also a variable. You can't use it without a statement.
Deletion of variables or objects is not allowed.
Deletion of functions is not allowed.
Duplicate names of variables are not allowed.
Octal is not allowed.
Escape characters are not allowed.
Assigning values to read-only properties is not allowed.
It is not allowed to assign a value to an attribute read using the getter method.
Deleting an attribute that is not allowed to be deleted is not allowed.
Variable names are not allowed to use the "eval" string.
Variable names are not allowed to use the "arguments" string.
Reserved keywords are not allowed.
For some security reasons, variables created in scope eval () cannot be called.
Prevents the this keyword from pointing to the global object.
The following statements are not allowed:
"use strict"
With (Math) {x = cos (2)}; / / error report
Retain keywords:
In order to transition to a future version of Javascript, strict mode adds the following reserved keywords:
Implements
Interface
Let
Package
Private
Protected
Public
Static
Yield
"use strict" (strict mode), instructions are only allowed at the beginning of a script or function.
This is the end of the content of "what is JavaScript strict Mode". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.