Dean Edwards has written and released a most useful tool that allows you to both compress and also obfuscate your JavaScripts source code. Not only will your page load quicker (smaller filesize) but your scripts are harder to steal as the source is difficult to read (to humans).
You can download the “packer” or use the online version.
Packed scripts should successfully unpack on all browsers that support JavaScript. Only basic JavaScript functionality is used to decode the packed script.
Some browsers may not support the packer itself. The web interface requires DOM support. Legacy browsers will display a disabled interface.
Among the more known users of this tool is jQuery, which is a great library with numerous plugins ready to use.