Array.push() is *NOT* a push-down stack.
It does exactly what you are seeing.
Basically if you do this:
Code:
var ary = [ ];
ary.push("apple");
ary.push("banana");
ary.push("coleslaw");
you get exactly the same result as if you had done
Code:
var ary = [ ];
ary[0] = "apple";
ary[1] = "banana";
ary[2] = "coleslaw";
which is the same you would get if you did
Code:
var ary = ["apple","banana","coleslaw"];
You can argue that the
push( ) method of Array is misnamed. But it's way too late to change it now. It is what it is.