I'm little confused with js 'delete' operator.
for example
var data = {
list : [a, b, c]
}
var temp = data;
console.log(temp.list[2]); //Result 'c'
console.log(data.list[2]); //Result 'c'
delete temp.list[2];
console.log(temp.list[2]); //Result undefined
console.log(data.list[2]); //Result undefined why?
in this case,
I have just only deleted temp.list[2]
but data.list[2]
shows undefined as well.
does 'delete' operator trace array address and delete data in it?
is that why data.list[2]
is also undefined? (because data.list[2]
has address, not the actual data itself)
I think there is explanation. can you help me?