How to output numbers with leading zeros in JavaScript?
NOTE: Potentially outdated. ECMAScript 2017 includes String.prototype.padStart. You’ll have to convert the number to a string since numbers don’t make sense with leading zeros. Something like this: Or, if you know you’d never be using more than X number of zeros, this might be better. This assumes you’d never want more than 10 digits. If you … Read more