js只保留整數,向上取整,四捨五入,向下取整等函數

1.丟棄小數部分,保留整數部分 parseInt(5/2)html 2.向上取整,有小數就整數部分加1dom Math.ceil(5/2)htm 3,四捨五入.對象 Math.round(5/2)table 4,向下取整隨機數 Math.floor(5/2)方法 Math 對象的方法 方法 描述 abs(x) 返回數的絕對值 acos(x) 返回數的反餘弦值 asin(x) 返回數的反正弦值 at
相關文章
相關標籤/搜索