Please check the jsfiddle - http://jsfiddle.net/du8svaym/
var a = [2, 4, "bang", undefined, NaN, 5]; for (i in a) alert(a[i]); //alerting a[3]=undefined delete a[1]; for (i in a) alert(a[i]); //Why not alerting a[1]= undefined? alert(a[1]); //it is undefined! but not alerted, what is happening under the hood? If you notice, the first loop alert alerts a value which is undefined. In the 2nd loop alert a[1] is undefined since we deleted it, but is not alerted. What is the difference between the two undefined, how exactly or differently is delete setting the undefined?