You don't get a forEach
method on arrays in any version of IE so far. Array.prototype.forEach
is an ECMA-262 Fifth Edition feature which you can't rely on being available: the browser support baseline is Third Edition, where there is no map
, filter
, forEach
or even indexOf
on arrays.
You can correct this by hacking the Array.prototype
to add the method if you like. See MDC's code, for example. Or, if you are using the prototype library, as you seem to be, you can use .each
, which hides the difference from you.
ECMA-262 is really hard to read; A useful place to look for the real supported-everywhere baseline for built-in types is in the old Netscape 4-era JavaScript reference. Ignore the DOM stuff which is best documented elsewhere, but it's good for the JavaScript built-in types.