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

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