百分数转化为小数
function toPoint(percent){ var str=percent.replace("%",""); str= str/100; return str; }
小数转化为百分数
//1.先转化为number类型 //2.再乘以100 //3.保留小数位 var point = 0.042; function toPercent(point){ var percent = Number(point*100).toFixed(1); percent+="%"; return percent; }