DEV Community

Discussion on: JavaScript undefined and null: Let's talk about it one last time!

Collapse
 
atapas profile image
Tapas Adhikary

One way I think I have faced it..

Whenever I have written something like,

if (!age) {

}
Enter fullscreen mode Exit fullscreen mode

I was sure, it ruled out undefined and null too. Knowing it gives additional confidence, :)!

Collapse
 
hermannp profile image
hermann-p

To be exact, it will also rule out NaN, "", '', and -- very error prone -- 0.

Thread Thread
 
atapas profile image
Tapas Adhikary

Yeah true.. all those unwanted things! :)