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?
3+3
'3'+3
'0' == 0
0 == false
'0' == true
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.
if (!response.constructor === Array) if (this.photoPath === undefined)
But I've never when debugging, had an error related to == vs === Lucky or dumb, or dumb luck I guess?
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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 where3+3is not the same as'3'+3? Or that'0' == 0but0 == falseand'0' == true?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?