Encodes the given data with base64. This encoding is designed to make binary data survive transport through transport layers that are not 8-bit clean, such as mail bodies.

Base64 is a group of similar binary-to-text encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation. The term Base64 originates from a specific MIME content transfer encoding.
[ Wikipedia - Mozilla base64 encoding and decoding ]

Code
var str = '✓ à la mode';
var base64 = btoa(encodeURIComponent(str).replace(/%([0-9A-F]2)/g,
        function toSolidBytes(match, p1) {
            return String.fromCharCode('0x' + p1);
    }));
> 4pyTIMOgIGxhIG1vZGU=

var str = decodeURIComponent(atob(base64).split('').map(function(c) {
        return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
    }).join(''));
> ✓ à la mode