根据这个http://caniuse.com/use-strict 'use strict'
在 IE 8/9 版本中不支持。
我的问题是,在 IE 8/9 或与其不兼容的浏览器中使用“use strict”真的安全吗?它会破坏我的代码吗?
最佳答案
声明 "use strict";
will 应该不会导致 IE8/9 出现问题,因为浏览器将运行该代码。 (就是这么设计的,保证没有实现严格模式的浏览器不会出问题)
外部来源:http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/
This means that you can turn strict mode on in your scripts – today – and it’ll have, at worst, no side effect in old browsers.
注意:正如 Jeremy 在评论中指出的那样,有些表达式在技术上是有效的,但在 IE8 中会失败(例如:var x = {}; x.break = true
不会在 IE8 中工作,即使它在 IE9 中工作)。
关于javascript - 在 IE 8/9 中使用 'use strict' 是否安全,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18223517/