Javascript Array Problem

arrays, javascript

Solution

The "delete" doesn't modify the array, but the elements in the array:

 # x = [0,1];
 # delete x[0]
 # x
 [undefined, 1]

What you need is array.splice

Problem

Why is JavaScript returning the wrong array length? ``` var myarray = ['0','1']; delete myarray[0]; alert(myarray.length); //gives you 2 ```

Original source