You forgot an important difference between JS and Java : the tooling is inferior. Sure you can use Typescript which makes thing a little bit better, but good luck with out dated type definitions or libraries that do not have type definitions, good luck with templates can't be validated ( forgot some directive ? misspelled a component name ? too bad you're fucked ... ). Java is verbose but there is a fairly large number of tools and IDE that make programming painless. JS on the other hand, good luck maintaining those 1 million LOC codebases ...
this is all true, but i think the problem of JS is not the lack of generics and types, but the mindset - an honest conviction that one should pile up one layer of code on top of another like there is no tomorrow. this is the common trait between Java and JS developers. the sheer complexity of the system is the problem, not tooling. old farts like me think that complexity is bad and we try to avoid it at all cost. young generation thinks that complexity is good and try to increase it at every opportunity they have.