-- 返回数字最接近的整数,四舍五入
document.write(Math.round(5.8));
document.write(Math.round(5.2));
document.write(Math.round(-5.8));
document.write(Math.round(-5.2));
结果:
6 5 -6 -5梦之都
-- 返回数字最接近的整数,四舍五入
document.write(Math.round(5.8));
document.write(Math.round(5.2));
document.write(Math.round(-5.8));
document.write(Math.round(-5.2));
结果:
6 5 -6 -5梦之都