I faced this strange situation where foreach like construct of javascript does not work in IE but it works in FF. Well not all for..in
just this special funcito
Well, it's supposed to work, so if it doesn't, the answer is as simple as "it's yet another bug in IE".
But the real question here is why you're using for ... in
to iterate over arrays or array-like objects (such as arguments
) -- just use a simple for
loop instead, which works in all major browsers:
for (var i = 0; i < arguments.length; i++) {
// do something with arguments[i]
}