How might window.btoa() be implemented in JS?