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

JavaScript中使用Math.floor()方法對(duì)數(shù)字取整

 更新時(shí)間:2015年06月15日 10:16:06   投稿:goldensun  
這篇文章主要介紹了JavaScript中使用Math.floor()方法對(duì)數(shù)字取整,是JS入門(mén)學(xué)習(xí)中的基礎(chǔ)知識(shí),需要的朋友可以參考下

 此方法返回比最大的整數(shù)小于或等于參數(shù)
語(yǔ)法

Math.floor( x ) ;

下面是參數(shù)的詳細(xì)信息:

  •     x : 一個(gè)數(shù)字

返回值:

返回比最大的整數(shù)小于或等于一個(gè)數(shù)x
例子:

<html>
<head>
<title>JavaScript Math floor() Method</title>
</head>
<body>
<script type="text/javascript">

var value = Math.floor(10.3);
document.write("First Test Value : " + value ); 
 
var value = Math.floor(30.9);
document.write("<br />Second Test Value : " + value ); 

var value = Math.floor(-2.9);
document.write("<br />Third Test Value : " + value ); 

var value = Math.floor(-2.2);
document.write("<br />Fourth Test Value : " + value ); 
</script>
</body>
</html>

這將產(chǎn)生以下結(jié)果:

First Test Value : 10
Second Test Value : 30
Third Test Value : -3
Fourth Test Value : -3 

相關(guān)文章

最新評(píng)論