DEV Community

Discussion on: Is there a reason to use == over ===?

 
mellen profile image
Matt Ellen-Tsivintzeli

The question was why to ever use == rather than the ===.

You're saying you never use === in JavaScript? Do you not fall foul of the problem where 3+3 is not the same as '3'+3? Or that '0' == 0 but 0 == false and '0' == true?

Thread Thread
 
faaktap profile image
Fakie Tap

I did a quick grep - and I see there is some place where I use ===

if (!response.constructor === Array)
if (this.photoPath === undefined)

But I use == much more frequently
Never realised that 0 == false and '0' == true - that is a nasty one.

But I've never when debugging, had an error related to == vs ===
Lucky or dumb, or dumb luck I guess?