This article is a mirror article of machine translation, please click here to jump to the original article.

View: 11341|Reply: 0

[JavaScript] The difference between let and var definition variables in js

[Copy link]
Posted on 8/9/2017 5:25:50 PM | | |
javascrip{filter}t strict mode

When you first encounter the let keyword, there is a concept that you need to pay very, very attention to is "Javascrip{filtering}t strict mode", for example, the following code will run an error:



The error message reads:



The workaround is to add the "javascrip{filter}t strict mode" declaration to the file header:




For a single function
If you put "use strict" on the first line of the function body, the entire function runs in "strict mode".




Similarities and differences between let and var keywords

The declaration is not assigned, and the performance is the same



Using undeclared variables, the performance is different:



When repeatedly declaring the same variable, the behavior is different:



The scope of variables is different







Previous:The detailed usage of createCriteria is the QBC query in Hibernate
Next:Misunderstanding of count(0) and count(*) in SQL statements
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com