DEV Community

loading...
Cover image for Oh JavaScript...

Oh JavaScript...

Harsh Shandilya
Full time Android developer in Kotlin and Java, experienced with Python and a work-in-progress Rustacean
・1 min read

Discussion (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 ==