js base64 encoding 1

js base64 encoding

var string = "Hello folks how are you doing today?";
var encodedString = btoa(string); // Base64 encode the String
var decodedString = atob(encodedString); // Base64 decode the String

Here is what the above code is Doing:
1. We have a string that we want to encode.
2. We use the btoa() function to encode the string.
3. We use the atob() function to decode the string.

Similar Posts