DEV Community

loading...

Discussion on: JS interview in 2 minutes / == vs ===

Collapse
samrocksc profile image
Sam Clark

So, I don't know if this will count towards your last example, but when I'm explaining this to new devs I use this:

const compare = null;
const us = undefined;
compare == us;
compare === us;
Enter fullscreen mode Exit fullscreen mode

And follow with the explanation that == has some valuable use cases if applied properly, and to never be afraid to use it if you need to confirm something is undefined or null.

I don't know! I like this article though, nice!