DEV Community

Zouhair Sahtout
Zouhair Sahtout

Posted on

Strict Mode

Using strict mood to write secure JavaScript.

Strict Mode makes it easier for us developers to avoid accidental errors.



Without the strict mode being active it's hard for me to guess where my code is broken.
Image description



Strict Mode also introduce a short list of variable names that are reserved for features, that might be added to the language a bit later.
Image description

Summary:

Strict mode allows the JavaScript interpreter to make some optimization that it can't do when using non-strict mode.
With that said under strict mode your code may well run faster.
Plus strict mode makes the rules of the language clearer so you are less likely to make a wrong assumption about your code.
Many people using strict mode without even knowing it since ES modules are inherently strict.
So if you're writing code in modules, which is generally how modern JavaScript is written these days, you're using it.

I hope that help clarify what strict mode is and how helpful can be.

Top comments (0)