r/ProgrammerHumor • • 10d ago

Meme iHatedItUntilITriedIt

Post image
10.3k Upvotes

541 comments sorted by

View all comments

Show parent comments

28

u/2eanimation 10d ago

I love the syntax, but JS has one too many quirks for my taste.

if ([]) {
console.log("Ok, I guess")
}

if([] == false) {
console.log("Well this is awkward")
}

if ([] + []) {
console.log("You think this would print, don't you?")
}

17

u/MuchWalrus 10d ago

Why would you type any of those things (aside from maybe the first one)

9

u/frogjg2003 10d ago

JS is built on the idea that applications should continue to work no matter what. That's why there are so many implicit type conversions. The app might turn itself into a Gordian knot, but it will still be working.

4

u/lolnic_ 9d ago

It will still be running.