const user={
    name:"hundsun",
    age:16
}

console.log(Object.isSealed(user));//判断对象是否被封闭
Object.seal(user);//封闭对象API

console.log(Object.isSealed(user));


Object.freeze(user);//冻结对象
console.log(Object.isFrozen(user));
 

 

posted on 2022-01-23 14:25  weakup  阅读(26)  评论(0编辑  收藏  举报