DEV Community

Discussion on: JSByte: How to check falsy values with null or undefined in JavaScript

Collapse
 
merri profile image
Vesa Piittinen

The only thing I'd like to add is that this is the only case you should ever use == for comparison, and always otherwise use ===. This is a good rule to follow especially if you're working without TypeScript or other type enforcement tool as it greatly reduces bugs caused by mixing datatypes.

Collapse
 
shrutikapoor08 profile image
Shruti Kapoor

Good point! Updating the post.