[JavaScript] strict mode use strict

use strict is not a statement, but a literal expression declaration, which is ignored in older versions of JavaScript.

insert image description here

Why use strict mode use strict:

Eliminate some unreasonable and imprecise parts of Javascript syntax, 减少一些怪异行为;
eliminate some unsafe parts of code running, 保证代码运行的安全;
improve compiler efficiency, 增加运行速度;
for the future 新版本的Javascript做好铺垫.

"Strict mode" reflects a more reasonable, safer, and more rigorous development direction of Javascript. Major browsers including IE 10 have already supported it, and many large projects have begun to fully embrace it.

On the other hand, 同样的代码,在"严格模式"中,可能会有不一样的运行结果;一些在"正常模式"下可以运行的语句,在"严格模式"下将不能运行。掌握这些内容,有助于更细致深入地理解Javascript,让你变成一个更好的程序员.

insert image description here
insert image description here
insert image description here

Guess you like

Origin blog.csdn.net/qq_39900031/article/details/131425626