2018年2月9日

js 常见的小数取整问题

摘要: 1、四舍五入取整 Math.round(5/2) // 3 2、直接去掉小数,取整 parseInt(5/2); // 2 3、向上取整,有小数整数部分就加1 Math.ceil(1/3) // 1 4、向下取整 Math.floor(1/3) // 0 阅读全文

posted @ 2018-02-09 15:22 程序猿-alvin 阅读(172) 评论(0) 推荐(0) 编辑

导航