First introduced in the ECMAScript version 5, strict mode is a way of ensuring our code doesn’t have any loose ends. …
Ever wondered how to prevent your code from mutating object properties whose values should never change?
I know what you’re probably thinking, why not just use a const keyword to declare the object? well, doing it that way would only prevent the variable itself from being mutated and not the object properties, for example:
One way we could achieve this is to use the
Object.freeze() method, but that locks down the entire object and in some cases we might not want that to happen,
Front End Developer