How to avoid problems with your javascript code.

Posted on

Avoid problems

Why did we use these examples? Do we have to remember these peculiarities all the time? Well not really. In fact, these tricky things will gradually become familiar over time, but there’s a solid way to avoid trouble with them:

Process any comparison with undefined/null except strict equality

===
Enter full screen mode

Exit full screen mode

with exceptional care.
Do not use comparisons

>= > < <=
Enter full screen mode

Exit full screen mode

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

Leave a Reply

Your email address will not be published.