Y
Hacker News
new
|
ask
|
show
|
jobs
by
chaorace
846 days ago
Seems like the logical way to do it. Though, honestly, unless you specifically need to do lots of different kinds of padding, something like this makes way more sense:
const bespokePad = (x) => ('000000' + x).slice(-6)