rmurphey / js-assessment-answers

125 stars 84 forks source link

Alternate solution for convertToBinary? #112

Open notaurologist opened 7 years ago

notaurologist commented 7 years ago

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 can send a PR if there's agreement here.