JavaScript was not supposed to a lot of things.
10 years ago this sentence probably would have start a flame war. ;-)
Though it’s hard to imagine what the web would look like if the language had become the standard. JS is a pain but AS was even less suitable for general purpose compute.
ActionScript3 was a very suitable language.