I am encountering this error on Internet Explorer 9.0 under F12 development tools, in the following statement:
arr = [];
for (i = 0; i < items.length; i ++) {
console.log(items[i]);
arr.push(items[i].join(','));
}
This method work on every browser except IE. Why isn’t it working?
Here’s my guess (since we’re lacking information).
It could be a combination of the following:
You’re testing in IE8, or if you’re using IE9, you’re in Quirks Mode
When you built the Array, you included a trailing
,In Quirks Mode, or in IE8 and lower, if you include a trailing comma in Array literal syntax, it’ll (incorrectly) add an extra item the end of the Array.
This means your last item will be
undefined, and you’ll get an Error when you use.join().In IE8 and lower, or any version in Quirks Mode, you’ll get the following: