DEV Community

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

Posted on

1

Oh JavaScript...

Top 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 ==

👋 Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay