No competition? How about Flash, Java applets, ActiveX, Silverlight, and even VBScript -- which Microsoft pushed to compete directly with JavaScript as the embedded scripting language for the web.
JavaScript lives in a more diverse environments: Multiple browsers, webkit engine, now NodeJS, React, etc.
Varieties, cross pollination from different JS engine/teams make JS much stronger.
Flash, ActiveX, Silverlight, VBScript are all seem more mono-culture - Start to die as soon as the parent organizations/core dev team loss interest / move on to to next best thing.
Flash is a successful until CPU usage, security issues kill it. Just like strong mono-culture plant in a farm got wipe out certain deceases/virus.