Skip to content

Instantly share code, notes, and snippets.

@abdobouna
Last active August 29, 2015 14:13
Show Gist options
  • Save abdobouna/b654202fcbb67d85540f to your computer and use it in GitHub Desktop.
Save abdobouna/b654202fcbb67d85540f to your computer and use it in GitHub Desktop.
Creates a list of zero-filled numbers.
function zeroList( min, max ) {
var maxLen = max.toString().length;
var ret = [];
var zeroCount;
var zeros;
for ( var i = min; i <= max; i++ ) {
zeroCount = maxLen - i.toString().length;
zeros = '';
while ( zeroCount-- )
zeros += 0;
ret.push( zeros + i );
}
return ret;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment