Skip to content

Instantly share code, notes, and snippets.

@js1972
Created September 5, 2013 04:55
Show Gist options
  • Save js1972/6446250 to your computer and use it in GitHub Desktop.
Save js1972/6446250 to your computer and use it in GitHub Desktop.
#javaScript pad will pad a number with leading zeros
/* 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