DEV Community

Discussion on: What’s your alternative solution? Challenge #49

Collapse
 
swkidd profile image
swkidd

not the most readable answer but!

binaryToNumber = s => {let r=0; s.split('').reverse().forEach((c,i) => r += c*2**i); return r}