Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
Mr_Modulo
· 4y ago · 0 comments
<number>.toString(2) Wouldn't be quite right because the output needs to be padded out with zeros.
Comments
[–]
vanderZwan
4y ago
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...