Skip to content

Instantly share code, notes, and snippets.

@fredrick
Created December 28, 2010 16:51
Show Gist options
  • Save fredrick/757409 to your computer and use it in GitHub Desktop.
Save fredrick/757409 to your computer and use it in GitHub Desktop.
Converts integers such as '1' to strings "01"
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