PDA

View Full Version : remove array element


surnit
01-02-2003, 09:37 PM
How do I remove array elements(values) in javascript 1.3. I did see the documents it does have pop method, but it removes the last element. I want to remove an element of specific index.

Tanker
01-02-2003, 09:48 PM
Look into Array.Splice , that should do what I think your trying to do.

beetle
01-02-2003, 10:58 PM
Aye, Array.splice() is what you need.

var myArray = [0,1,2,3,4];
myArray.splice( 2, 1 );
alert( myArray );
// alerts '0,1,3,4'