Object.freeze
Object.freeze
allows us to disable object mutation.
One problem with this pattern however, is how much more verbose our code is and how difficult it is to read and understand what's actually going on with our data with all of the boilerplate calls to Object.freeze
and Object.assign
. We need some more sensible interface to create and interact with immutable data, and that's where Immutable.js fits in.
Note: Object.freeze
is also very slow and should not be done with large arrays.
Last updated
Was this helpful?