In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
In this article Xiaobian for you to introduce in detail "what is the role of use strict instructions in JavaScript", the content is detailed, the steps are clear, and the details are handled properly. I hope that this article "what is the role of use strict instructions in JavaScript" can help you solve your doubts.
Use strict instruction in JavaScript
"use strict" is a new instruction in JavaScript 1.8.5 (ECMAScript version 5).
It's not a statement, it's a literal expression, and earlier versions of JavaScript ignored it.
The purpose of "use strict"; is to indicate that JavaScript code should be executed in "strict mode".
In strict mode, you cannot, for example, use undeclared variables.
"use strict"; grammar
The syntax for declaring strict mode is designed to be compatible with earlier versions of JavaScript.
Compiling numeric text (such as 4x5) or string text ("Bill Gates") in a JavaScript program will not have a negative effect. It just compiles to variables that don't exist and then disappears.
All "use strict" will only have an impact on the new translator that "understands" its meaning.
Why use strict mode?
Strict patterns make it easier for us to write "secure" JavaScript.
Strict mode transforms previously acceptable "bad grammar" into real errors.
For example, in a normal JavaScript, mistyping a variable name creates a new global variable. In strict mode, this throws an error so that it is not possible to create a global variable accidentally.
In a normal JavaScript, if you assign a value to an unwritable attribute, the developer will not get any error feedback.
In strict mode, assigning a value to an unwritable, readable, nonexistent property, or to a variable or object that does not exist, will throw an error.
Items that are not allowed in strict mode
It is not allowed to use variables without declaring them:
"use strict"
X = 3.14
After reading this, the article "what is the role of use strict instructions in JavaScript" has been introduced. If you want to master the knowledge of this article, you still need to practice and use it yourself to understand it. If you want to know more about related articles, you are welcome to follow the industry information channel.
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: 233
*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.