Created
September 5, 2013 04:55
-
-
Save js1972/6446250 to your computer and use it in GitHub Desktop.
#javaScript pad will pad a number with leading zeros
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* function to pad a number with leading zeroes */ | |
function pad(num, size) { | |
var s = num+""; | |
while (s.length < size) s = "0" + s; | |
return s; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment