DEV Community

Cover image for How to avoid problems on your javaScript code.
N Cee Dee
N Cee Dee

Posted on

4 4

How to avoid problems on your javaScript code.

Avoid problems

Why did we go over these examples? Should we remember these peculiarities all the time? Well, not really. Actually, these tricky things will gradually become familiar over time, but there’s a solid way to avoid problems with them:

Treat any comparison with undefined/null except the strict equality

===
Enter fullscreen mode Exit fullscreen mode

with exceptional care.
Don’t use comparisons

>= > < <=
Enter fullscreen mode Exit fullscreen mode

with a variable which may be null/undefined, unless you’re really sure of what you’re doing. If a variable can have these values, check for them separately.

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

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

Okay