Now, you can just use .toLocaleString() to format a number in any way you like. Back then you would need a custom function to do that for you, now you can do it directly. Just call this function and it will return the string for you, and you can print it or save it for later use.
Format numbers in Javascript
other posts