Blame JS all you want but the problem of sustainability is, sadly, not a technical one. Write it in Python or C if what you're doing is endlessly pushing video memes or SEO-optimized "content", that's still wasted energy.
A nuclear and solar grid powered 3 tons vehicle isn't much more sustainable than an ICE one if it's still carrying 1.1 human on average.