Strict Mode
Zouhair Sahtout
Posted on September 9, 2023
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.
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.
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.
Posted on September 9, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.