The best you can do is obfuscating your JavaScript code to make it unreadable. It can still be decoded by someone with motivation and plenty of spare time, but well, that's always the case for code that runs on the client, including binary executables. Just note here that obfuscated JavaScript is
slow, or at least it takes a bit longer to load.
Here is a link with a few solutions:
http://stackoverflow.com/questions/194397/how-can-i-obfuscateprotect-javascript[
^].
Let me add a few more that are not included in the link above: if you're using Visual Studio, you probably have Dotfuscator, that's a great tool to obfuscate asp.net code and also regular JavaScript.
http://www.jsobfuscate.com[
^] is one of several quick obfuscators that works in the browser (just copy and paste your JavaScript and push a button). If the size of the generated output is not a problem, this is a good tool.
Finally one of my favourites:
http://jscrew.it[
^] encodes any JavaScript using only 6 different characters on the fly (no need to push a button), has a Node.js module that can be run locally, and it can encode a file the size of jQuery (
no, seriously[
^]).
There are commercial solutions too, but I guess they're easy to find with Google if you look for "JavaScript obfuscation", although I don't recommend spending money for those tools.
This should be enough to get you started :-)