I believe, it's fixed in ECMAScript 2015: now check for `length` being < 2^32 is performed only on array creation [1], and < 2^53 when length is going to be updated [2].
See, for example, current algorithm of Array.prototype.forEach: http://www.ecma-international.org/ecma-262/6.0/#sec-array.prototype.foreach [1]: step 3 of ArrayCreate http://www.ecma-international.org/ecma-262/6.0/#sec-arraycreate [2]: for example step 7 of Array.prototype.push http://www.ecma-international.org/ecma-262/6.0/#sec-array.prototype.push // Sorry for duplication, answered in the private email first. 2015-07-13 14:18 GMT+03:00 Michał Wadas <[email protected]>: > Steps to reproduce: > > let p = { > 0: 'a', > 1: 'b', > 2: 'c', > length: Math.pow(2,32)+1 > }; > Array.prototype.forEach.call(p, (el)=>console.log(el)); // logs only 'a' > > The cause of this behaviour is obvious for anyone that reads > specification - every native Array.prototype methods perform abstract > operation `ToUint32(this.length). > > Anyway - this behaviour obviously counters intuition. I think it would > be totally OK to allow native methods to throw when .length > 2^32, > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

