最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

When did Internet Explorer add support for the for..in loop in JavaScript? - Stack Overflow

programmeradmin1浏览0评论

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:

  • (v=vs.94).aspx ("Requirements" section near the bottom)

Which version of Internet Explorer added support for this?

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:

  • http://msdn.microsoft./en-us/library/ie/55wb2d34(v=vs.94).aspx ("Requirements" section near the bottom)

Which version of Internet Explorer added support for this?

Share Improve this question edited Nov 12, 2012 at 17:03 Paul D. Waite asked Nov 12, 2012 at 16:39 Paul D. WaitePaul D. Waite 98.9k57 gold badges202 silver badges271 bronze badges 7
  • There is quite a good site out there for this type of questions: caniuse. – 11684 Commented Nov 12, 2012 at 16:42
  • 2 How old are you talking about? What versions of IE are you actually supporting? – I Hate Lazy Commented Nov 12, 2012 at 16:43
  • 2 @11684 That's where I went to answer this question. Couldn't find for..in loops there, probably because they are an essential JS feature that's been around for so long. – Matt Commented Nov 12, 2012 at 16:43
  • 1 A little chart from MS: msdn.microsoft./en-us/library/ie/s4esdbwz(v=vs.94).aspx – epascarello Commented Nov 12, 2012 at 16:48
  • 3 it is hard to see that , 20K+ reputation users asked such silly question rather then simply navigating mozilla javascript reference guide . – Paritosh Piplewar Commented Nov 12, 2012 at 16:52
 |  Show 2 more ments

4 Answers 4

Reset to default 7

As far as I can remember, every browser ever supporting JS has had to have support for ... in because until recently it was the only way to enumerate the keys of an object.

It is supported at least in IE6+. The for-in loop is in Ecmascript 3 which browsers have supported for a very long time. You should feel as fortable using for-in as any other JS construct.

According to Microsoft docs, the for...in statement was added in JScript version 5.0, which is used in Internet Explorer 5.0 .

JScript is Microsoft's implementation of ECMAScript3. The prior link shows the products they use it, including old versions of Internet Explorer, Windows and VisualStudio.

According to microsoft official web site, here is what they say :

for...of Statement (JavaScript) Not supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Not supported in Windows 8.1.

发布评论

评论列表(0)

  1. 暂无评论