我有以下很大的数字:2.9364136545300044e+24
我注意将这个值格式化为2,936,413.65
value
我该怎么做?有没有可以制作的库?
您可以使用Intl.NumberFormat.prototype.format
,String.prototype.slice()
,String.prototype.concat()
var number = 2.9364136545300044e+24;
var n = new Intl.NumberFormat().format(number);
var res = n.slice(0, 9).concat(".").concat(n.slice(10, 12));
console.log(res);
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句