📜  javascript 格式数字作为货币 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:22.947000             🧑  作者: Mango

代码示例6
// Javascript has a number formatter (part of the Internationalization API).

const number = 123456.789;

// another example 
console.log(new Intl.NumberFormat('ja-JP',  {
  style: 'currency',
  currency: 'BWP',
}).format(number));

// MORE INFO ->  https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat