var number = 1557564534; document.body.innerHTML = number.toLocaleString(); // Output: 1,557,564,534
MyNumberAsString.replace(/(d)(?=(ddd)+(?!d))/g, "$1,");