var b64 = btoa('guru'); console.log(b64); //-> "Z3VydQ=="
And of course, the reverse process — to decode Base64 values use the function atob:
var str = atob('Z3VydQ=='); console.log(str); //-> "guru"
Although there is nothing complicated about these functions, you should remember the following:
There are some objects that support methods for converting values to a Data URIs. Thanks to them, you can get Base64 values by simply removing the data URI prefix, which may be faster than using