编辑.如果要指定精度,请应用一些基本数学:
function roundup(x, digits) {
var m=Math.pow(10, digits);
return Math.ceil(x*m)/m;
}
Run Code Online (Sandbox Code Playgroud)
另请参阅:Math.round(),Math.floor()
如果你的意思是"round.max" ROUND(MAX()),那么你会想要Math.max():
Math.max(x, y, z, ...)
Math.max.apply(null, someArray)
Run Code Online (Sandbox Code Playgroud)