cnblogs/dcrenl/js中的整除运算.html
2024-09-24 12:43:01 +08:00

7 lines
396 B
HTML

<div>&nbsp;&nbsp;Math.ceil(count / pagesize); //向上整除 4/3=2;</div>
<div>&nbsp;&nbsp;Math.floor(count / pagesize); //向下整除 4/3=1;</div>
<div>
<p style="display: inline !important;">&nbsp; Math.round(5/2);//四舍五入</p>
<p style="display: inline !important;">&nbsp;</p>
<p style="display: inline !important;">&nbsp; parseInt(5/2);//丢弃小数部分,保留整数部分</p>
</div>