I'm curious about the solution for convertToBinary. Currently, it's breaking off each bit and sticking it into an array to join later. I used num.toString(2) for the initial conversion and left-padded as necessary. Am I missing something? Does that solution not work everywhere? AFAIK, it is, but I may be wrong. Perhaps it's a performance issue, but it seems like it wouldn't be.
I'm curious about the solution for
convertToBinary
. Currently, it's breaking off each bit and sticking it into an array to join later. I usednum.toString(2)
for the initial conversion and left-padded as necessary. Am I missing something? Does that solution not work everywhere? AFAIK, it is, but I may be wrong. Perhaps it's a performance issue, but it seems like it wouldn't be.I can send a PR if there's agreement here.