You can just save class provided by Mark Brittingham in your unity scripts, and use it for encrypting / decrypting your strings, but its only C# solution. Im not sure if you can use it in javascript, but propably you could, since C# is compiled before javascripts (i think so). Its worth try though
If you want to obfuscate strings so no one can read them, I think best way would be to convert them to arrays of ints that contains Unicode values for each character and then do function that would take such array and decode it into string. You could also use some simple encryption on it like xoring or rot13.