Is there any way to create an array-like object in JavaScript, without using the built-in array? I\'m specifically concerned with behavior like this:
var sup
Mostly you don't need a predefined index-size for arrays in javascript, you can just do:
var sup = []; //Shorthand for an empty array
//sup.length is 0
sup.push(1); //Adds an item to the array (You don't need to keep track of index-sizes)
//sup.length is 1
sup.push(2);
//sup.length is 2
sup.push(4);
//sup.length is 3
//sup is [1, 2, 4]