亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

JavaScipt中的Math.ceil() 、Math.floor() 、Math.round() 三個函數(shù)的理解

 更新時間:2010年04月29日 23:20:02   作者:  
以前一直會三個函數(shù)的使用產(chǎn)生混淆,現(xiàn)在通過對三個函數(shù)的原型定義的理解,其實很容易記住三個函數(shù)。

首先還是看看JavaScript: The Definitive Guide, 4th Edition中對三個函數(shù)的定義。

Math.ceil(): round a number up

Arguments: Any numeric value or expression

Returns: The closest integer greater than or equal to x.

-----------------------------------------------------------------------------------------------

Math.floor(): round a number down

Arguments: Any numeric value or expression

Returns: The closest integer less than or equal to x.

-----------------------------------------------------------------------------------------------

Math.round(): round to the nearest integer

Arguments: Any number.

Returns: The integer closest to x.

 

以前一直會三個函數(shù)的使用產(chǎn)生混淆,現(xiàn)在通過對三個函數(shù)的原型定義的理解,其實很容易記住三個函數(shù)。

現(xiàn)在做一個總結(jié):

1. Math.ceil()用作向上取整。

2. Math.floor()用作向下取整。

3. Math.round() 我們數(shù)學(xué)中常用到的四舍五入取整。

相關(guān)文章

最新評論