function toPercent(point){
var str=Number(point*100).toFixed(2);
str+="%";
return str;
}
var point=0.123456;
console.log(toPercent(point))
最终结果是12.35%
js小数转换百分数并保留两位小数
最新推荐文章于 2022-11-05 16:30:33 发布
function toPercent(point){
var str=Number(point*100).toFixed(2);
str+="%";
return str;
}
var point=0.123456;
console.log(toPercent(point))
最终结果是12.35%