r/programming • • Mar 26 '14

JavaScript Equality Table

http://dorey.github.io/JavaScript-Equality-Table/
809 Upvotes

331 comments sorted by

View all comments

Show parent comments

8

u/Poltras Mar 26 '14

I would say that promoting bad behavior is the problem with JavaScript. Why have == at all?

1

u/[deleted] Mar 26 '14

JavaScript was designed to fill specific needs two decades ago. Type coercion was probably a useful addition for early use cases.

6

u/Poltras Mar 26 '14

That's why I'm a big proponent of a new browser language (be it Dart or something). JavaScript was made for constructs like onclick="this.className=(!this.className || 'clicked')". The fact that we are using it for applications now doesn't make it a good language by design, and "just use that instead of this" is a poor defense for fundamental flaws. And I'm not only talking about true vs truthy. Scope, context and this also comes to mind.

2

u/[deleted] Mar 26 '14

I read a lot about how fundamentally flawed JavaScript is on blogs and Reddit, but I never -- not rarely, never -- have problems caused by any of them despite using the language every day.

JavaScript is a flawed language, and beginner programmers can make some mistakes in it that aren't possible elsewhere, but in practice it doesn't matter and none of my problems can ever be blamed on JavaScript.

→ More replies (2)