Freeze 2020-3-17

# 如何修改 person 对象

const person = {
  name: "Lydia Hallie",
  address: {
    street: "100 Main St"
  }
};

Object.freeze(person);
  • A: person.name = "Evan Bacon"
  • B: delete person.address
  • C: person.address.street = "101 Main St"
  • D: person.pet = { name: "Mara" }

如果一个属性的值是个对象,则这个对象中的属性是可以修改的,除非它也是个冻结对象。

# 参考