This works:
var y=["Banana", "Orange", "Apple", "Mango"];
y.splice(0,1);
document.write(y);
It gives (predictably): Orange,Apple,Mango
This is also OK:
var z={};
z[32]="Help";
z[14]="Go";
But this doesn’t work:
z.splice(32,1);
The error message in Firebug is:
Error: z.splice is not a function …
There’s clearly a rule I don’t know about. What is it, and how does one splice out something like z[32]?
Thanks.
y is an array and z is an object.
You can’t use a function in the array prototype in an object.
Will work fine.