I am trying to delete a object property which is shallow copy of another object. But the problem arises when I try to delete it, it never goes off while original value throws expected output.
var obj = {
name:"Tom"
};
var newObj = Object.create(obj);
delete newObj.name;//It never works!
console.log(newObj.name);//name is still there
referenced!var newObj = obj;It would work as you are expecting!newObjhas nonameproperty, so your delete is useless on it. It isnewObj's prototype ===obj, which has thenameproperty... or not if you deleted it...