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);返回數組的最大值;