"Worst popular computer language in history." That's a bit strong, isn't it? It certainly has its faults, but so did VB6 (and other BASIC variants, for that matter). PHP gets widely slagged off as well. Does it deserve it? Possibly, to some extent, but people still manage to successfully build useful software with it.
With JavaScript, the problem isn't so much the language (though there are many ways to use and misuse it) as its ubiquity and ease of entry. Because it's so popular it attracts many novice programmers who write terrible code (but that's how we all start). If we're going to have any good, experienced engineers in future then we need those novices now.
If C++, Haskell, Ruby, or Scala were as popular as JavaScript - particularly if one of them were the standard for client-side web programming - there'd be just as much terrible code written in those languages; it would just be differently terrible.
I disagree. Languages like Haskell are much less tolerant of terrible code, which is a large part of the reason why beginners struggle with it.
I work with other peoples Haskell code daily; and some of this code has been written by domain experts. Nevertheless, Haskell mostly forces them into line. Our competitors use Python because it is superficially "easy", I can only imagine what horrors they must be dealing with.
Part of this is that with Haskell it's much more like there's one right way to do things, and that's it. JavaScript is a multi-paradigm language and so in that way it's always possible to get into more of a mess. I could say the same about, for example, C++.
Maybe beginners do struggle with Haskell but, if you want my two cents, the reason nobody really bothered with it back when I was at university - except for assignments where we had to use it - was because there was no call for it out in the world (this is going back 17 years). Most people built their projects in C, C++, or Java because those were what you needed to get a job. I'd also observe that the same people that struggled with Haskell also struggled with C, C++, and Java [1].
Again, based on the assignments where people did write Haskell I'd have to suggest that it absolutely is (or was) possible to write terrible code in Haskell. Certainly it's possible to write broken, fragile, or barely functional code that's hard to understand.
[1] This is of course anecdotal evidence based on a small sample size - maybe 40 people on the course.
Funny, because I would hire a person straight from university as a junior developer, if she chose to write all the assignments with Haskell instead of going with C/C++/Java/whateverpopularlanguage. That would be a really good sign.
I think times have changed though. Functional languages just weren't big back then the way they are now. Back in those days Haskell was sloooooooow. There's 17 years of runtime and compiler optimisation, not to mention MUCH faster hardware, that's been developed in between. It's now totally realistic to use the expressive power of functional languages on real-world workloads in a way that it mostly wasn't back in Y2K.
There's a continuum of restriction of style. The Python guys say the same thing about Perl. "We can handle our diversity, but the Perl guys are completely out of control so I don't know how anyone can handle that."
Imagine being a clothing designer and told to make something. The output could be anything from Beyonce's grammy dress to a famous deceased CEO who wore black turtlenecks all the time. That extreme diversity of style is both the greatest strength and the greatest weakness of allowing a wide allowable spectrum of style. On the other hand a men's business suit tailor is much more restricted in that everything kinda looks the same which makes things both very easy to muddle thru and very difficult to stand out at the same time.
I'm not sure I like your clothing analogy, it implies that Haskell deliverables are somehow restricted in functionality, which isn't true. The "style" that Haskell prohibits is hiding side-effects and mutable state behind something that pretends to be a function. If you are honest and upfront about what you are doing, i.e. you fully understand what you are doing, then Haskell has no problem letting you do it.
With JavaScript, the problem isn't so much the language (though there are many ways to use and misuse it) as its ubiquity and ease of entry. Because it's so popular it attracts many novice programmers who write terrible code (but that's how we all start). If we're going to have any good, experienced engineers in future then we need those novices now.
If C++, Haskell, Ruby, or Scala were as popular as JavaScript - particularly if one of them were the standard for client-side web programming - there'd be just as much terrible code written in those languages; it would just be differently terrible.