Skip to content

Instantly share code, notes, and snippets.

@KLicheR
Created May 16, 2013 19:57
Show Gist options
  • Save KLicheR/5594599 to your computer and use it in GitHub Desktop.
Save KLicheR/5594599 to your computer and use it in GitHub Desktop.
Function to add leading zero to a int.
function addLeadingZero(value) {
if (value < 10 && value >= 0) {
return('0'+value);
}
else if (value < 0 && value > -10) {
return('-0'+Math.abs(value));
}
return value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment