Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Array index handling

Starting with Windows Internet Explorer 9, array elements with large indices are handled differently than in earlier versions.

Windows Internet Explorer 8 does not conform to the ECMAScript (3rd edition) specification in situations where the initial value of the array's length property is greater than 2E+31-1 (that is, 2147483647). When an Array element is created with an index greater than 2147483647, the index of new element created will be a negative integer.

Internet Explorer 9 correctly handles Array elements that use indices between 2E+31-1 and 2E+32-2. The Internet Explorer 8 behavior is not replicated in any of the Internet Explorer 9 document modes.

This can be observed when an element is pushed to an array of length 2E+31-1.

If your webpage uses large arrays, test your code between Internet Explorer 8 and Internet Explorer 9.

The following example prints "true" in Internet Explorer 8, but prints "false" in Internet Explorer 9.


function test() {
    var arr = new Array();		
    arr[2147483650] = 10000;
    arr.push(10);	
    document.write(arr["-2147483645"] == 10);
}
test();

Related Topics

 

 

Show:
© 2015 Microsoft