Problem: I have a set of large integers I’m trying to display on a page. As they are, they’re just a long string of numbers which makes it hard to tell where the thousands, millions, billions, etc. places are. How can I format these integers with commas so that they are human-readable?
Solution: The easiest solution is to use the built-in toLocaleString() function. It’s not the fastest method, but it’ll get the job done. I’ve tested it in FireFox and Chrome and it’s worked fine. For more info, you can check out the original StackOverflow post.
var num = 3000000;