Gday All,
I have a string indexed array that I would like to remove an item from.
Consider the following example code:
var arr = new Array();
arr[0] = "Zero";
arr[1] = "One";
arr[2] = "Two";
arr.splice(1, 1);
for (var index in arr)
document.writeln(arr[index] + " ");
//This will write: Zero Two
var arr = new Array();
arr["Zero"] = "Zero";
arr["One"] = "One";
arr["Two"] = "Two";
arr.splice("One", 1); //This does not work
arr.splice(1, 1); //Neither does this
for (var index in arr)
document.writeln(arr[index] + " ");
//This will write: Zero One Two
How do I remove "One" from the second example like I did in the first?
Cheers,
Michael