Pad a given number with leading zeroes. Useful to make it a fixed width like with e.g. sprintf in other programming langages.
- Example:
00001,00012,00123,01234,12345
pad(number, count);
// returns number with leading zerosSee the 140byt.es site for a showcase of entries (built itself using 140-byte entries!), and follow @140bytes on Twitter. And check my "JavaScript Golf Lessons" slides.
to be honest, it's not my forte. i defer to the REAL sensei, like peter van der zee and mathias bynens. i'm more of a pragmatist, and just worked my way down until it did what i wanted it to.