javascript中Math.floor的真正含义及用法?
来源:网络收集 点击: 时间:2024-02-12【导读】:
本文将为您讲解javascript中Math.floor的真正含义及用法工具/原料moreHbuild、HbuildX等HTML开发工具方法/步骤1/3分步阅读
2/3
3/3
打开开发工具(以HbuildX为例),并新建一个基本HTML项目Demo01

打开index.html文件并输入
script type=text/javascript
//Math
document.write(Math.floor(5.1))
document.write(Math.floor(5.2))
document.write(Math.floor(5.3))
document.write(Math.floor(5.4))
document.write(Math.floor(5.5))
document.write(Math.floor(5.6))
document.write(Math.floor(5.7))
document.write(Math.floor(5.8))
document.write(Math.floor(5.9))
/script
注意:script标签是为了在html文件中引入JavaScript代码
之后我们预览查看效果,结果为555555555

在JavaScript中Math.floor() 方法执行的是向下取整的计算,它的返回值是最接近参数且不大于参数的整数。
注意事项为方便预览,以上为html文件直接引入js代码效果
JAVASCRIPT版权声明:
1、本文系转载,版权归原作者所有,旨在传递信息,不代表看本站的观点和立场。
2、本站仅提供信息发布平台,不承担相关法律责任。
3、若侵犯您的版权或隐私,请联系本站管理员删除。
4、文章链接:http://www.1haoku.cn/art_27667.html
上一篇:在信捷PLC里面使用C函数功能块
下一篇:只狼怎么踩头