const user = { name:"angdh", age:11 }; //不容许添加属性 Object.preventExtensions(user); //检查是否可以添加属性 if (Object.isExtensible(user)){ user.site = "www.sssss"; console.log(user); }
const user = { name:"angdh", age:11 }; //不容许添加属性 Object.preventExtensions(user); //检查是否可以添加属性 if (Object.isExtensible(user)){ user.site = "www.sssss"; console.log(user); }