use strict 指令
限制JavaScript中某些功能的使用。仅在Internet Explorer 10和Windows 8.x应用商店app中受支持。
语法
use strict
备注
示例
由于在严格模式中,必须使用var声明所有变量,因此下面的代码将导致语法错误。
"use strict"; function testFunction(){ var testvar = 4; return testvar; } intvar = 5;
限制JavaScript中某些功能的使用。仅在Internet Explorer 10和Windows 8.x应用商店app中受支持。
use strict
由于在严格模式中,必须使用var声明所有变量,因此下面的代码将导致语法错误。
"use strict"; function testFunction(){ var testvar = 4; return testvar; } intvar = 5;
如果你喜欢这篇文章,敬请给站长打赏↑