`
Turbo12138
  • 浏览: 41339 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

javascript除法如何取整

 
阅读更多
javascript除法如何取整  
Math.round(x) 四舍五入,如Math.round(0.60),结果为1;Math.round(0.49),结果为0;  
Math.floor(x) 向下舍入,如Math.floor(0.60)与Math.floor(0.49),结果均为0;  
Math.ceil(x)向上舍入,如Math.ceil(0.60)与Math.ceil(0. 49),结果均为1。  
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics