Skip to content

Print numbers with commas as thousand separators in JavaScript

We can use Number.prototype.toLocaleString() method which returns a string with a language-sensitive representation such as thousand separator,currency etc of the number.

let n = Number(123456789);
console.log(n.toLocaleString()); //123,456,789

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.