Opposite of Object.freeze or Object.seal in JavaScript

前端 未结 9 1355
无人共我
无人共我 2020-12-02 21:41

What is the opposite of Object.freeze or Object.seal? Is there a function that has a name such as detach?

9条回答
  •  鱼传尺愫
    2020-12-02 22:45

    You cannot unfreeze (thaw) an object, but if the object is simply a collection of primitives (no functions or classes), you can get a thawed clone of the object like this:

    const unfrozenObj = JSON.parse(JSON.stringify(frozenObj));
    

提交回复
热议问题