4/03/2018

Math物件可以執行方法做數學的運算。

JavaScript的Math物件可以執行方法做數學的運算。


Math.round(x) : 將x四捨五入到整數。
Math.round ( ) =
Math.round ( ) =

Math.floor(x) : 將x往下減到整數。
Math.floor ( ) =
Math.floor ( ) =

Math.pow(7,2) 返回7的2次方,即為7X7=49。
Math.pow( , ) =

Math.sqrt(49) 表示49的平方根,即為\( \sqrt 49 \)=7。
Math.sqrt( ) =

Math.abs(x) : 將x轉成正數。( 將x轉成負數 張 x 成 -1 OK)
Math.abs( ) =

Math.ceil(x) : 將x往上加到整數。
Math.ceil( ) =

Math.min() : 找出參數列表中最小的值。
Math.min( , , , ) =

Math.max() : 找出參數列表中最大的值。
Math.max( , , , ) =

沒有留言:

發佈留言

343434 123 456 3434 343434