Array.prototype.toLocaleStringintermediateconst prices = [9.99, 24.50]
prices.toLocaleString('en-US', {style:'currency', currency:'USD'})
// β '$9.99,$24.50'Pass locale and options to toLocaleString() to format numeric values as currency.
Combine Array.prototype.map with Number.prototype.toLocaleString to format each amount as a USD currency string, then join them.
Implement formatCurrencies(amounts) that maps each number to n.toLocaleString('en-US', {style:'currency', currency:'USD'}) and joins with ', '.