For javascript to run the code needs to be loaded in the user's browser, thus making it readable and copyable by the user.
I am working on a new webpage that features a simple tool. It simply requires some math to work. None of which is secret, complex or innovative in any real way. I am doing it as a side project for myself but figured I can put it online. Given that this tool is purely mathematical means that I can code it entirely in JS and the user's browser can do all the calculations. But this also means that any a scammer can simply copy my code and throw-up a 1000 copies of the page with zero effort.
Copying the page would be simple enough regardless, in fact my page is likely a copy as I am almost certain that such tools must already exist (I can't even be bothered to check). The formula for the math is on Wikipedia. But in my experience most scammer/spammers don't really do the math, reading and writing thing. So hiding some or all of the math on my server would likely be a sufficiently big hurdle to prevent theft.
Is it worth the effort? In pure js all that is required is to serve a static html page with the script embedded. Hiding the math requires multiple end-points to handle a bunch of fetch requests as well as determining the logic of how to send the data back and forth between the server and client. All this requires a far more complex server setup.
Are there any other means of preventing spammers from stealing your JS code?