Last active
August 29, 2015 14:13
-
-
Save abdobouna/b654202fcbb67d85540f to your computer and use it in GitHub Desktop.
Creates a list of zero-filled numbers.
This file contains hidden or 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 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