DEV Community

Zouhair Sahtout
Zouhair Sahtout

Posted on

1

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.

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (0)

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay