DEV Community

loading...

Discussion on: Demystifying "const" variables in JavaScript

Collapse
joeattardi profile image
Joe Attardi

To add to this - if you want your object to actually be immutable, you can use Object.freeze. If the object contains other objects, this will only freeze the first level of values. You can use the deep-freeze package to recursively freeze the object.