1,Math.ceil()方法向上取整,整數部分值+1:
eg:Math.ceil(3/2) 輸出:2
2,Math.floor()方法向下取整,整數部分值不變:
eg:Math.floor(3/2) 輸出:1
3,Math.round()方法四捨五入取整:
eg:Math.round(3/2) 輸出:2
4,parseInt()方法 拋去小數部分,只取整數部分:
eg:parseInt(3/2) 輸出:1
1,Math.ceil()方法向上取整,整數部分值+1:
eg:Math.ceil(3/2) 輸出:2
2,Math.floor()方法向下取整,整數部分值不變:
eg:Math.floor(3/2) 輸出:1
3,Math.round()方法四捨五入取整:
eg:Math.round(3/2) 輸出:2
4,parseInt()方法 拋去小數部分,只取整數部分:
eg:parseInt(3/2) 輸出:1