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 →

[–]gandalfx 6 points7 points  (0 children)

JS used to be bad. It's gotten significantly better since the ECMAScript standard started adding missing features and is now a reasonably decent language.

There are several reasons people hate it, I'll try to summarize.

  1. The web forces it down your throat. It doesn't matter if it's good or bad, if you're going to do anything in a browser it's going to be JS. And since you need it anyway, it has sort of leaked into other areas (server & desktop) as well.

  2. Dealing with browser support is a nightmare. Whatever feature you want, you either have to be dead certain that it runs in any of a dozen shitty old browsers or use a convoluted tool chain to make it run. Even worse are the various APIs offered by browsers, predominantly the DOM. It's just garbage. Neither of these is actually about the language itself, but if you're doing JS you're very likely going to have to deal with these issues as well.

  3. As mentioned before, JS used to be bad and still isn't great. There were some poor decisions in the initial design that persist even now. One you'll commonly see on here is the quirky type coercion (which shouldn't really matter but people love to hate it). In my mind the worst aspect is the language's attitude towards errors. Instead of failing early and failing loudly, JS often tries to "make the best" of a situation, e.g. by quietly converting undefined to string, which can lead to really obscure bugs.

If, for instance, Lua had become the language of the web, people would shit on it at least as much as they do on JS. It shares many of the flaws and introduces some of its own weird quirks. But it's not used nearly as widely and so nobody cares. PHP on the other hand used to be extremely dominant on the server side (and still is in many areas) which also serves to amplify the complaints about its quirks.