
エントリーの編集

エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。

- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
JavaScriptで億とか万とかに変換したいときはNumberFormatのnotation:compactが便利
const fmt = new Intl.NumberFormat("ja-JP",{ notation: "compact", }) fmt.format(BigInt(64 ** 8) ) ... const fmt = new Intl.NumberFormat("ja-JP",{ notation: "compact", }) fmt.format(BigInt(64 ** 8) ) // => "281兆" とりあえずざっくり数値を出したいときにとても便利。最高そう。 オプションを組み合わせる 詳しくは上記MDNが詳しいが、その他オプションと組み合わせることで色々調整も可能だ // 何も設定しないといい感じに小数点計算してくれる new Intl.NumberFormat("ja-JP",{ notation: "compact"}).format(BigInt(433333333)) // => "4.3億" // 小数点表記をさせたくなければmaximumFractionDigitsを0にする new Intl.NumberFormat("ja-JP",{ notation
2021/02/22 リンク