floor办法如何使用
发布时间:09/01 来源:未知 浏览:
关键词:
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办法如何使用的具体内容,更多请关注百分百源码网其它相关文章!