- 0133技术站
- 联系QQ:18840023
- QQ交流群
- 微信公众号
Math.round()方法将数字四舍五入为最接近的整数。
语法:
Math.round( x ) ;
参数:
● x - 代表一个数字
例:
console.log("---Math.round()---") console.log("Math.round(7.2) : "+Math.round(7.2)) console.log("Math.round(-7.7) : "+Math.round(-7.7))
输出:
---Math.round()--- Math.round(7.2) : 7 Math.round(-7.7) : -8
推荐手册