β

Answer by worldask for delete a property or set it

User worldask - Stack Overflow 34 阅读

delete will really remove the property from its owner, in your code is this object.
But set property to null or undefined won't do that.

You can check it using this:

for(var i in obj) {
    if (obj.hasOwnProperty(i)) {
        console.log(i, '' + obj[i]);
    }
}
作者:User worldask - Stack Overflow
most recent 30 from stackoverflow.com
原文地址:Answer by worldask for delete a property or set it, 感谢原作者分享。