JavaScript Format Number With Thousands Comma Separator

March 21, 2020
Format 10000 as 10,000

Soution 1

const nf = Intl.NumberFormat()
nf.format(10000)

NOTE: Intl.NumberFormat Browser Support

Solution 2

const n = 10000
n.toLocaleString()

NOTE: toLocaleString Browser Support

This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.