Knowledgize

.toLocaleString()

Returns a string representing the elements of the array formatted according to locale conventions.

Examples:

let prices = [1000.99, 2000.39, 3000.79]; let priceStrings = prices.toLocaleString('en-US', { style: 'currency', currency: 'USD' }); console.log(priceStrings); // '$1,000.99,$2,000.39,$3,000.79'
let dates = [new Date('2021-01-01'), new Date('2022-02-02')]; let dateStrings = dates.toLocaleString('en-GB'); console.log(dateStrings); // '01/01/2021, 02/02/2022'