Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.com/en-us/library/ie/55wb2d34(v=vs.94).aspx ("Requirements" section near the bottom)

Which version of Internet Explorer added support for this?

like image 255
Paul D. Waite Avatar asked Dec 27 '22 14:12

Paul D. Waite


2 Answers

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.

like image 94
Alnitak Avatar answered Jan 14 '23 14:01

Alnitak


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 comfortable using for-in as any other JS construct.

like image 40
Brian Terlson Avatar answered Jan 14 '23 15:01

Brian Terlson