LoginSignup
1
1

More than 3 years have passed since last update.

javascriptで数値をカンマ区切りにする

Posted at

数値をカンマ区切りにする

もうあれこれ悩まない!数値にカンマをつけるたった一つの方法

<%= new Intl.NumberFormat('ja-JP', {maximumSignificantDigits: 3}).format(item.price) %>

オプションもたくさんありますのでcurrency対応がとても楽になりますね。
ほとんどのサイトではIntlのためにbabelを使う必要はありません。
(*対応したいブラウザが古い場合は必要になります)

参考

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1