You're right in that JS is a horrible language -- it was designed very quickly (and IMO Brendan Eich did a great job in the time he was given).
There are some things JS got right and things JS got wrong -- but I basically put it at the same level as languages like python/ruby/perl.
Another great thing about JS is that if you hate the semantics of JS, you can transpile -- pick up Typescript, Flow, Elm, Purescript. Compile-time-checking-as-an-addon, linters, transpilers, have all seen a tremendous uptick in interest partly thanks to JS's shortcomings.
Also, what in your opinion is a "good" language? because the list of innovative languages with amazing time-saving features/ground breaking research in them is very different from the list of workhorse languages people use from day to day.
This is all by unfortunate necessity, certainly not by choice.
The very raison d’etre of languages like TypeScript that transpile to JavaScript is because of the flaws of this hack language that simply found itself in the right place at the right time in history
It can scale but it takes an increadible amount of care.
Everything has to have unit tests and documentation and be split out into reasonable modules. Large scale projects in C are honestly easier to work on than JavaScript.
It does scale but almost no one puts in the effort to do it.
If writing a lot of support code is inevitable anyway, why not automate writing tests, etc? That is, why not write a proper translator from a more expressive language? Something like Elm, maybe.