Hacker News new | ask | show | jobs
by Mr_Modulo 1489 days ago
<number>.toString(2) Wouldn't be quite right because the output needs to be padded out with zeros.
1 comments

Oh, right, good catch! So <number>.toString(2).padStart(8, "0") then. I still expect it to be faster than this clever hack though.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...