Difference between freeze and seal

后端 未结 8 1016
孤独总比滥情好
孤独总比滥情好 2020-12-07 08:00

I just heard about the JavaScript methods freeze and seal, which can be used to make any Object immutable.

Here\'s a short example how to u

8条回答
  •  渐次进展
    2020-12-07 08:27

    You can always looks these up in MDN. In short:

    • Freeze: makes the object immutable, meaning no change to defined property allowed, unless they are objects.
    • Seal: prevent addition of properties, however defined properties still can be changed.

提交回复
热议问题