标签:pre OLE let tofixed 百分比 小数 个数 ons code
let a=1;
let b=2;
let sun=a+b;
// 同时扩大100
let am=a*100;
let bm=b*100;
let sunm=sun*100;
// toFixed(2 );保留位数2的同时四舍五入
console.log( ((am/sunm)*100).toFixed(2) +"%" )
标签:pre OLE let tofixed 百分比 小数 个数 ons code
原文地址:https://www.cnblogs.com/IwishIcould/p/13366265.html