Example Code to document Array maximum length behavior in JavaScript.
An Array with the maximum length of 4294967295 can still be extended by directly accessing the next slot via []. But the length is no longer increased.
In contrast Array.push will fail as the length value can't be increased.
a = newArray(3);
console.log("Length before new element: ",a.length);
a[a.length]="Newend";
console.log("New length after element was added: " , a.length);
console.log("[][length-1] should return last element: ", a[a.length-1]);
console.log("[][length] should return undefined: ", a[a.length]); // undefinedconsole.log("-----------")
b = newArray(4294967295);
console.log("Length before new element: ", b.length);
b[b.length]="Newend";
console.log("New length after element was added: ", b.length);
console.log("[][length-1] should return last element: ", b[b.length-1]);
console.log("[][length] should return undefined: ", b[b.length]);
try{
b = newArray(4294967295);
b.push(123);
}catch(e){
alert("Array push failed: "+ e.message)
}