Comma separate strings and numbers in JavaScript

I recently had to format large numbers using JavaScript and was really missing Rails' numberwithdelimiter function. Heres a simple version for JavaScript.