📜  javascript intl.numberformat percent - Javascript 代码示例

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

代码示例1
var discount = 0.251;

var option = {
   style: 'percent',
   minimumFractionDigits: 2,
   maximumFractionDigits: 2
};
var formatter = new Intl.NumberFormat("en-US",option);
var discountFormat = formatter.format(discount );
console.log(discountFormat);