function returnFloat(value) {
var value = Math.round(parseFloat(value) * 100) / 100;
var xsd = value.toString().split(".");
if (xsd.length == 1) {
value = value.toString() + ".00";
return value;
}
if (xsd.length > 1) {
if (xsd[1].length < 2) {
value = value.toString() + "0";
}
return value;
}
};
// var num=99;
// console.log(returnFloat(num));
原文地址:https://www.cnblogs.com/Byme/p/8662899.html
时间: 2024-10-26 04:14:52