Created
August 23, 2009 22:05
-
-
Save sixty4bit/173479 to your computer and use it in GitHub Desktop.
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
<script type="text/javascript"> | |
function comma(num) { | |
var collector = new Array(); | |
var numberArray = ('' + num).split('').reverse(); | |
for(var i = 0; i < numberArray.length; i++) { | |
if(i % 3 == 0 && i != 0) collector.push(","); | |
collector.push(numberArray[i]); | |
} | |
return collector.reverse().join(''); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment