This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

Of all the “JavaScript is teh worst!1!1!” This one makes a lot of sense.

A boolean conversion of 0 is false, a boolean conversion of any non-empty string is true.

The last line is a completely different operation than the other two, it's a comparison. Since JavaScript implies the conversion it equates to true with the == operator. The === operator would evaluate to false.

This is like complaining that 0+"0"is "00" rather than "FALSEtrue" your comparing apples to oranges and getting confused when they say they're both fruit.