3 ms·
<number>.toString(2) Wouldn't be quite right because the output needs to be padded out with zeros.
by Mr_Modulo 4y ago
<number>.toString(2) Wouldn't be quite right because the output needs to be padded out with zeros.
- vanderZwan 4y agoOh, 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/Reference/Global_Objects/String/padStart https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...