javascript 保留小数

//num表示要四舍五入的数,v表示要保留的小数位数。
function decimal(num,v)
{
    var vv = Math.pow(10,v);
    return Math.round(num*vv)/vv;
}

原文地址:https://www.cnblogs.com/Denny_Yang/p/2008900.html