Math.floor( ) Math对象的方法--取比当前数值小的最大整数 (下取整)。
Math.ceil( ) Math对象的方法--取比当前数值大的最小整数 (上取整)。
Math.round( ) Math对象的方法--四舍五入。
toFixed( ) Number对象的方法--四舍五入保留n位小数。
parseInt( ) 转换为整数
js实际测试结果:
document.writeln(Math.round(10 / 3)); //3
document.writeln(Math.ceil(10/3)); //4
document.writeln(Math.floor(10/3)); //3
var a = 12.3456
document.writeln(a.toFixed(2)); //12.35
document.writeln(parseInt(21.55)); //21