4

If I remember correctly, older versions of Internet Explorer didn't support the for..in statement.

I've no idea which versions though, and it's not the easiest thing to Google.

According to Microsoft, it's supported in Quirks Mode, and in standards mode from IE 6 onwards:

Which version of Internet Explorer added support for this?

4

4 回答 4

7

据我所知,每个支持 JS 的浏览器都必须支持for ... in,因为直到最近它还是枚举对象键的唯一方法。

于 2012-11-12T16:41:37.433 回答
3

它至少在 IE6+ 中受支持。for-in 循环在 Ecmascript 3 中,浏览器已经支持了很长时间。使用 for-in 应该和使用任何其他 JS 构造一样舒服。

于 2012-11-12T16:41:55.253 回答
1

根据 Microsoft 文档,for...in 语句是在 JScript 5.0 版中添加的,它在 Internet Explorer 5.0 中使用。

JScript 是 Microsoft 的 ECMAScript3 实现。前面的链接显示了他们使用的产品,包括旧版本的 Internet Explorer、Windows 和 VisualStudio。

于 2019-10-29T02:38:08.323 回答
-1

根据微软官方网站,他们是这样说的:

for...of Statement (JavaScript) 以下文档模式不支持:Quirks、Internet Explorer 6 标准、Internet Explorer 7 标准、Internet Explorer 8 标准、Internet Explorer 9 标准、Internet Explorer 10 标准、Internet Explorer 11 标准。在 Windows 8.1 中不受支持。

于 2017-09-12T13:09:31.690 回答