The array declaration difference between Firefox and IE JavaScript interpreter May 21, 2010

Found interesting difference in array declaration between FF and IE. For example, if leave comma (,) after all elements in array there will be different size of array as a result:

var arr = [1,2,3,];
document.write(arr.length);

As a result in Firefox and Safari it will write “3” but in IE it will be “4”.

 
2 Comments
Kathey Ouzts April 6th, 2013

I appreciate you taking the time to share them with all of us.

 
Dean Arciniega April 8th, 2013

Thanks for sharing this on your weblog.

 
Leave a Reply