Short answer: You cannot / do not.
Longer answer: You cannot hide it at all. It works on the client and cannot be compiled for machine code. However, you can minimize it - this basically confuses it by truncating variable names, removing spaces, etc. Although typically used to save bandwidth, it also makes the code less readable. Note that everything except changed variable names and deleted comments can be easily undone by something like jsbeautufier .. but for a large application it is very difficult to understand the code without any meaningful variable names or functions or comments.
source share