欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

javascript中floor使用方法總結

 更新時間:2019年02月02日 10:59:05   投稿:laozhang  
在本篇文章中小編給大家分享了關于javascript中floor使用的知識點內容,有興趣的朋友們學習下。

floor()方法的基本語法

Math.floor( x ) ;

x表示數字,返回小于或等于數字x的最大整數。

我們下面來看具體的示例

代碼如下

<!DOCTYPE html>
<html>
 <head>
  <title></title>
 </head>
 <body> 
<script type="text/javascript"> 
 document.write(Math.floor(-2)+"<br/>"); 
 document.write(Math.floor(-2.56)+"<br/>"); 
 document.write(Math.floor(2.56)+"<br/>"); 
  document.write(Math.floor(7.2+9.3));  
</script> 
 </body>
</html>

瀏覽器上運行效果如下:所有數字的輸出都會小于或等于其最大整數。

以上就是本篇關于floor知識點的全部內容,感謝大家對腳本之家的支持。

相關文章

最新評論