PDA

View Full Version : Deleting array values and gaps



theHollow
October 13th, 2005, 08:24 AM
if i have the following array

myArray[0] = "value 0";
myArray[1] = "value 1";
myArray[2] = "value 2";
myArray[3] = "value 3";

and i delete the second the value. is there anyway to stop it looking like this:

myArray[0] = "value 0";
myArray[1] = undefined;
myArray[2] = "value 2";
myArray[3] = "value 3";

and make it look like this:

myArray[0] = "value 0";
myArray[1] = "value 2";
myArray[2] = "value 3";

Thanks,
Brendan Smith

claudio
October 13th, 2005, 09:30 AM
myArray.splice(1,1)

theHollow
October 13th, 2005, 09:39 AM
thanks again claudio