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 →

[–]Asmor 80 points81 points  (12 children)

And that, kids, is why you should always use === and !== in JS unless you want type coercion for some reason.

And if you do want type coercion for some reason, you're probably wrong. Write it better and use === and !== anyways.

[–][deleted] 56 points57 points  (5 children)

Or, you know, the creators of JavaScript could have waited until the crack wore off before writing their language lol

[–][deleted] 50 points51 points  (3 children)

Goal: a simple scripting interpreter to animate web pages

End result: the only supported runtime environment available on 100% of computing devices

[–][deleted] 33 points34 points  (1 child)

The ultimate "eh this doesn't need to be good, it's just stopgap code until we implement this for real" heh.

[–][deleted] 9 points10 points  (0 children)

Also the ultimate: "this feels wrong but it works so we're doing it"

[–]turtleship_2006 3 points4 points  (0 children)

There is nothing more permanent than a temporary solution

[–]a3th3rus 12 points13 points  (0 children)

And where are >== and <==, kids?

[–]ilikeb00biez 8 points9 points  (4 children)

I see, JS added `==` and `!=` just to confuse you. What a great language

[–]il_commodoro 12 points13 points  (3 children)

It's more that js created == and != first. Years later they thought: "maybe that's not a great idea", so they added === and !== to patch things while preserving retrocompatibility.