feat(btoa): port and modify from Array.of.js

Please review my code and give me some advice, thanks @tomchentw .
I guess this `if - else` block can be replaced by just one line of `assignProperty(result, index, value, false);`?