Math.ceil(11.2) =12 向上取整
Math.floor(11.6)=11 向下取整
Math.round(11.5)的结果为12,
Math.round(-11.5)的结果为-11 四舍五入
本文介绍了JavaScript中常用的数学函数,包括向上取整、向下取整和四舍五入的方法。通过具体示例,如Math.ceil(11.2)=12、Math.floor(11.6)=11和Math.round(11.5)=12等,帮助读者理解这些函数的使用场景。
Math.ceil(11.2) =12 向上取整
Math.floor(11.6)=11 向下取整
Math.round(11.5)的结果为12,
Math.round(-11.5)的结果为-11 四舍五入

被折叠的 条评论
为什么被折叠?