base64 in javascript code example
Example 1: javascript base64 encode
var string = "Hello folks how are you doing today?";
var encodedString = btoa(string);
var decodedString = atob(encodedString);
Example 2: base 64 in js
var string = 'Hello World!';
var encodedString = btoa(string);
console.log(encodedString);
var decodedString = atob(encodedString);
console.log(decodedString);
Example 3: javascript base64 decode
var decodedString = atob(encodedString);
Example 4: js base64 encoding
str = "The quick brown fox jumps over the lazy dog";
b64 = btoa(unescape(encodeURIComponent(str)));
str = decodeURIComponent(escape(window.atob(b64)));