DEV Community

Cover image for Oh JavaScript...
Harsh Shandilya
Harsh Shandilya

Posted on

Oh JavaScript...

Latest comments (1)

Collapse
 
sainig profile image
Gaurav Saini

I got another one, it goes like this

0 == '0'  // gives true, okay, I'm there
0 == []   // also gives true, hmm, I see where you're going with this

// so according to basic maths,
// if a equals b, and a equals c, then b must be equal to c
// okay, let's try this

'0' == [] // gives false

// aight Imma head out

Its funny, how I actually faced this problem in an real production project. Last day I ever used ==