I don't really know if this is a bug, or a feature of Firefox's JavaScript core engine. Say I have an array:
var array = [];
I set the length of the array to a very large… (xem thêm)
I don't really know if this is a bug, or a feature of Firefox's JavaScript core engine. Say I have an array:
var array = [];
I set the length of the array to a very large number:
array.length = 155555555;
This now turns the variable array into an array with 155555555 blank slots. If I then do:
array[502039410402] = 5; // Notice that 502039410402 > the previously set 155555555 for length
array.length remains at 155555555, but the actual array is appended with a sudden index 502039410402 (i.e., index 155555553, 155555554, and then suddenly index 502039410402; see screenshot), with that element containing 5. Is this a bug, or an intended feature?
I would appreciate it if anyone could let me know.
Thanks!