As a JavaScript developer, it’s possible that you might have used strict mode at one point or the other in your code and if you haven’t, well, you might someday. Strict mode can be helpful when trying to debug your app because it brings up errors that you normally wouldn’t expect in sloppy mode (more on that later), the opposite of strict mode, so let’s get to it.

Image for post
Image for post

What Is Strict Mode?

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:

mutating properties
mutating properties

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, Object.freeze()


Edmund Ekott

Front End Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store