1,基本方法:

  Math.round();向上四舍五入。

  Math.ceil();向上取整,有小数就整数部分加1 

  Math.floor(5/2) ;向下取整 

  Math.abs();返回绝对值;

  Math.max();返回两个以上参数的最大值;

  Math.min();返回两个以上参数的最小值;

2,其他方法:

  parseInt();丢弃小数部分,保留整数部分;参数为正数时相当于floor;

3,组合方法:

  Math.max.apply(null, a);返回数组的最大值;
  Math.min.apply(null, a);返回数组的最大值;

相关文章:

  • 2019-09-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-09
  • 2021-06-01
  • 2021-05-17
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-07
  • 2021-09-27
相关资源
相似解决方案