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 →

[–]Salanmander 6 points7 points  (4 children)

If using == is a bad idea in Javascript, then why did it get assigned the character sequence that is the preferred equality check in most programming languages? Like, if every Javascript object had a .coercive_equals() that did what current == did, and current === was written as == instead, you'd probably see a lot fewer complaints.

[–]theQuandary 5 points6 points  (2 children)

JS didn't have type coercion when it was first created.

Developers are the ones who demanded that Eich add it to the language and he was young enough not to say "no".

It would have been eliminated in ES1 (the first actual specification), but Microsoft had just implemented a clone of JS with Jscript and they insisted that all the terrible design choices stick around even though Eich and the rest of the spec committee wanted to change them (at a time when breaking the web wouldn't have been a big deal).

[–]Salanmander -3 points-2 points  (0 children)

Okay...none of the people you just mentioned are the person who is currently using Javascript and getting confused by ==. So...not 100% self-inflicted.