DEV Community

Discussion on: Lockdown Fun: Your Age In Binary

jonkantner profile image
Jon Kantner

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

madsstoumann profile image
Mads Stoumann Author • Edited on

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