Created
December 28, 2010 16:51
-
-
Save fredrick/757409 to your computer and use it in GitHub Desktop.
Converts integers such as '1' to strings "01"
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 padInt(number){ | |
if (parseInt(number) < 10){ | |
return "0" + parseInt(number).toString(); | |
} else { | |
return number.toString(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment