Skip to content

Instantly share code, notes, and snippets.

@weslleyaraujo
Created January 5, 2014 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weslleyaraujo/8268509 to your computer and use it in GitHub Desktop.
Save weslleyaraujo/8268509 to your computer and use it in GitHub Desktop.
Simple function to padding your number
function padding(str, len, char) {
return (Array(len).join(char)+str).substr(-len);
}
padding(1, 2, 0) // 01
padding(1, 2, 0) // 02
padding(1, 2, 0) // 27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment