Javascript is older than Flash and ActiveX.
Originally, it was developed by the Netscape, as the "small cousine" of the Java.
The "World Wide Web" was originally developed only for static content without client-side dynamical behaviors, and with only zero to little server-side dynamical content.
Javascript became capable to replace Flash & ActiveX only with HTML5 in the early 2010s. Its main reason was that all client-side web programming technologies were closed or in the hands of a single company, Javascript was the only "least common denominator" between the major browser developers.
Thus, initially - roughly at the early nineties - the Javascript didn't replace anything, it was new.
There were still some possibilities for dynamical content, mainly by server-side support, but its possibilities were very weak. For example, images could dynamically created and re-used by sending refreshing http headers with images, and then refer them in <img src=...
tags.
The most common technology before the WWW was gopher, which supported only static content, too. At this time, non-graphical user environments were more common, they were remotely used by telnet, or more early, by serial terminals.