var arr = ["a", "b", "c",null,undefined];
delete arr[0];
for (var i = 0,j=arr.length; i < j; i++) {
console.log(arr[i]);
/*
undefined
b
c
null
undefined
*/
}
for (var o in arr) {
console.log(arr[o]);
/*
b
c
null
undefined
*/
}
who can tell me why the output is different?
you have access by key;
array index is key of array object
using delete keyword, remove object key
because
ok?
and see this
good luck!