It depends what you are trying to change.
It's absolutely possible to use the Flarum javascript API inside an inline script tag, but it's very tedious to write by hand, because you need to resolve every single import. If you're going to write a lot of javascript, it will probably still be easier to write it locally as an extension, compile it using Flarum's webpack configuration, and then insert the compiled javascript inside a script tag. Or load the file from a CDN. There might be a few changes to make to the webpack output to use it this way.
Some of the easier changes might be possible without using the Flarum javascript API, but keep in mind Flarum is a single page app, so it's not very reliable to modify any HTML without extending the Mithril components.