[Javascript] delete keyword

delete keyword doesn't actually delete the value but just the reference.

var me = {
  name: {
    first: "Wan"
  }
};

var wan = me.name;

delete me.name;

console.log(wan.first); //Wan

 

So here, what actually delete is the point of me.name:

So the point from 'anme' to "first" is remove by delete "me.name". 

 

And is is not possible to delete the whole object like:

delete me; //false

It will retrue false.

posted @ 2016-06-14 20:17  Zhentiw  阅读(179)  评论(0编辑  收藏  举报