Well if you are using a client-side scripting language like javascript then it is not possible. There are some ways to encode your js code but there are more ways to decrypt those. So there is no 100% solution available for a client-side code to hide from the end user.
I will recommend you to use a server side language to hide sensitive data. But if you really want to go with client-side then you can use obfuscation your code which I already told you is not a 100% solution.
I hope I have described it well.