JS is fine, it's more that people overdo it and bundle their heavy, deeply layered frameworks with thousands of npm dependencies for the web. Often times analytics/tracking/ad libraries are a major contributor of bloat, I once shrunk down a package-lock from thousands of lines to a few hundred just by stripping the telemetry libraries from an open-source app.
Use the right tool for the job. Sometimes it's a static page, sometimes a server-rendered dynamic page and sometimes a single-page application, all of those can be made performant.