Additional Thoughts About JavaScript and Substack
Substack users can benefit from JavaScript in bookmarklets and browser extensions.
Substack posts can also link to URLs that run JavaScript. But I don't see why a publisher would need those URLs. The publisher could instead link to a webpage (or page on a code playground) containing the JavaScript.
As for running JavaScript on the Substack post, it might work on the web. But it might not work on every email client.
Also, I suppose we as Substack publishers should respect Substack's limitation of links to http(s) and mailto. Perhaps Substack will someday allow buttons that could apply JavaScript to the page – say, to change the page's color scheme or translate the page. But I can understand why Substack would want its pages safe from any arbitrary JavaScript that publishers might insert.
My conclusion: If you want to provide JavaScript for your users to apply to newsletter posts, the best way is probably by creating a bookmarklet or a browser extension for them to use (probably only on a desktop browser). If you'd like ideas for bookmarklets, Jesse's Bookmarklets, while more than 15 years old and not as functional as it used to be, still has some interesting examples.