With the assumption that you don't have to support IE < 10, use native ECMAScript.
Use window.atob()
1 and window.btoa()
2
Since:
DOMStrings are 16-bit-encoded strings 3
/* Base64 Encode */
var base64Enc = window.btoa("Surya@gmail.com"+":"+"Password01");
/* Base64 Decode (as UTF16 DOMString) */
var utf16Dec = window.atob(base64Enc);
1 https://developer.mozilla.org/en-US/docs/Web/API/window.atob
2 https://developer.mozilla.org/en-US/docs/Web/API/window.btoa
3 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Base64_encoding_and_decoding