场景一:
const obj = {
name :'232'
};
obj.name = '哈哈哈';
console.log(obj.name); // 哈哈哈
场景二:
const obj = Object.freeze({
name:'51451',
age:50
});
obj.name = '122';
console.log(obj.name) //51451
上面代码 对象的值不会再次赋值
场景一:
const obj = {
name :'232'
};
obj.name = '哈哈哈';
console.log(obj.name); // 哈哈哈
场景二:
const obj = Object.freeze({
name:'51451',
age:50
});
obj.name = '122';
console.log(obj.name) //51451
上面代码 对象的值不会再次赋值