[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.

原文地址:https://www.cnblogs.com/Answer1215/p/5585337.html