tags:

views:

134

answers:

3

any simply way ?

this is my code:

var a=[1,2,3,4]
        a.slice(0,1)
        alert( a)

and it print [1,2,3,4]

thanks

+2  A: 

You want the splice method.

David Dorward
+6  A: 

You're looking for the splice() method:

var a=[1,2,3,4];
a.splice(1,1);
alert(a);        // -> 1,3,4
Andy E
+3  A: 

You should rather use splice instead of slice:

var a = [1,2,3,4];
a.splice(1, 1);
alert(a);
AndiDog