javascript - What's the benefit of Object.freeze() not freezing objects within the passed object? -
I was learning more about Javascript's object
constructor methods on MDN and I saw That last sentence sentence:
Note that there are objects that can still be modified until they are even frozen.
Such behavior seems like it should choose what is the benefit of manually frozing objects of a frozen object?
If I am freeing the object, then why would I want the objects to remain unstable in it?
The answer is in the same point
Note that the objects are Still can be modified, until they are not even frozen.
Update:
There is no official information about the design decision of the freeze () method
< / Blockquote>I think that, for the reasons of basically performance reasons , they have taken this decision, if we want to freeze internal objects, then we should use the method Must be applied repeatedly . So this is a big overhead, so the design decision was made to avoid this.
If this was not a demonstration, the method would behave differently.
Comments
Post a Comment