DEV Community

Discussion on: Lockdown Fun: Your Age In Binary

Collapse
 
jonkantner profile image
Jon Kantner

It’s also possible with age.toString(2), but I assume leading 0s need to be there.

Collapse
 
madsstoumann profile image
Mads Stoumann • Edited

Thanks! Yes, I want to show the leading zeroes, so with padStart it's total.toString(2).padStart(8, '0')