A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.

Douglas Adams

‘item’ is a reserved word in IE’s javascript engine/

May 28th, 2014

This caught me out again recently. Having been programming in other languages I had gotten back in to the habit of using item as an identifier for a complex object path:

var item = data.summary[i].observations[j];

This fails in IE as item is a ‘reserved’ word. I put it in quotes as it is not listed as a reserved word though it contains native code. This seems like a Really Bad Decision as item is such a useful word in instances like this, but I will try and get myself into the habit of using something like datum, though that is not ideal as it is a function in d3.

Digging a little further I did find out that item is in fact a method of IE’s Enumerator object.

And for reference here is a link to list of reserved words.

Categories:
Web Design|IE Gotchas