Created
May 16, 2013 19:57
-
-
Save KLicheR/5594599 to your computer and use it in GitHub Desktop.
Function to add leading zero to a int.
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 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