Stop stop!
First problem, while yes most things in js are objects, do not iterate over arrays with for in. "for ... in" is for object literals. Use a normal iterative loop for arrays.
Second, delete is intended to delete properties on objects. Again, arrays are objects but this isn't the right use of delete.
If you want to set the value of an array index to undefined, just assign it undefined.
myarray[2] = undefined;
Edit:
The reason you don't use for...in on an array is this:
var x = [1,2,3];
x.test = 'abc';
for(var i in x){
console.log(x[i]);
}
//1,2,3,abc
for(var i=0; i<x.length; i++){
console.log(x[i]);
}
//1,2,3
What Dmitry seems to be trying to do is only return indices that have values. Do it like this.
for(var i=0; i<myarray.length; i++){
if( myarray[i] !== undefined ){
console.log( myarray[i] );
}
}
Again, to set an index to undefined you shouldn't use delete. You can, but don't. Just do:
myarray[i] = undefined;
Hope this helps.