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) +"%" )