base64

Author: YaffleCreated Oct 13, 2011Updated Oct 13, 2011

Your base64Decode fails on the following tests: // var tests = [ ['YW55IGNhcm5hbCBwbGVhcw', 'any carnal pleas'], ['YQ', 'a'], ['YR', 'a'], ['', ''], ['YQA=', 'a\u0000'], ['YW55IGNhcm5hbCBwbGVhcw==YW55IGNhcm5hbCBwbGVhc3VyZS4=', 'any carnal pleasany carnal pleasure.'], ['YW55IGNhcm5hbCBwbGVhcw==YW55IGNhcm5hbCBwbGVhc3VyZS4', 'any carnal pleasany carnal pleasure.'] ];

see https://gist.github.com/1284012

Source: humanwhocodes/computer-science-in-javascript