Subscribed unsubscribe Subscribe Subscribe

通貨記号つきで金額を表示

便利。(最近まで知らなかった)
IEは11以上なら大丈夫。

console.log(number.toLocaleString('ja-JP', { style: 'currency', currency: 'JPY' }))
// → ¥123,457

console.log(new Intl.NumberFormat('ja-JP', { style: 'currency', currency: 'JPY' }).format(number));
// → ¥123,457

When formatting large numbers of numbers, it is better to create a NumberFormat object and use the function provided by its NumberFormat.format property.