同桌上课用手指进去了好爽_欧美丰满熟妇xxⅹⅹ性大i_成人av天天日天天拍拍_猛男gay帅男gay男男同志_欧美va天堂在线观看_人妻无码av中文系列三里桃花_亚欧免费无码在线观看_久久久精品国产亚洲av水_日韩在线免费看污污污_2021无码专区人妻系列日韩

首頁(yè) 優(yōu)化推廣 js筆記之Math random()、ceil()、floor()、round()

js筆記之Math random()、ceil()、floor()、round()

來(lái)源: | 時(shí)間:2013/6/8 15:40:46 |

JavaScript: The Definitive Guide, 4th Edition中對(duì)Math.ceil(),Math.floor()與Math.round()三個(gè)函數(shù)的定義。


Math.random()


 
返回 0 ~ 1 之間的隨機(jī)數(shù)。
 

 

Math.ceil()

ceil() 方法可對(duì)一個(gè)數(shù)進(jìn)行上舍入。

參數(shù)必須是一個(gè)數(shù)值。返回值大于等于 x,并且與它最接近的整數(shù)。

Math.floor()

floor() 方法可對(duì)一個(gè)數(shù)進(jìn)行下舍入。

參數(shù)可以是任意數(shù)值或表達(dá)式。返回值小于等于 x,且與 x 最接近的整數(shù)。

Math.round()

round() 方法可把一個(gè)數(shù)字舍入為最接近的整數(shù)

參數(shù)必須是一個(gè)數(shù)值。返回值與 x 最接近的整數(shù)。

 document.writeln("Math.ceil(4.8992303)輸出結(jié)果:"+Math.ceil(4.8992303)+"<br/>"); document.writeln("Math.floor(4.8992303)輸出結(jié)果:"+Math.floor(4.8992303)+"<br/>"); document.writeln("Math.round(4.8992303)輸出結(jié)果:"+Math.round(4.8992303)+"<br/><br/>"); document.writeln("Math.ceil(4.29993354)輸出結(jié)果:"+Math.ceil(4.29993354)+"<br/>"); document.writeln("Math.floor(4.29993354)輸出結(jié)果:"+Math.floor(4.29993354)+"<br/>"); document.writeln("Math.round(4.29993354)輸出結(jié)果:"+Math.round(4.29993354)); 

Math的Ceil,Floor,Round三個(gè)函數(shù)

 

服務(wù)熱線(xiàn)

153 8323 9821

功能和特性

價(jià)格和優(yōu)惠

網(wǎng)站和維護(hù)

推廣和優(yōu)化

微信服務(wù)號(hào)