广告合作
  • 今日头条

    今日头条

  • 百度一下

    百度一下,你就知道

  • 新浪网

    新浪网 - 提供新闻线索,重大新闻爆料

  • 搜狐

    搜狐

  • 豆瓣

    豆瓣

  • 百度贴吧

    百度贴吧——全球领先的中文社区

  • 首页 尚未审核订阅工具 订阅

    javascript中Math.floor的真正含义及用法?

    来源:网络收集  点击:  时间:2024-02-12
    【导读】:
    本文将为您讲解javascript中Math.floor的真正含义及用法工具/原料moreHbuild、HbuildX等HTML开发工具方法/步骤1/3分步阅读

    打开开发工具(以HbuildX为例),并新建一个基本HTML项目Demo01

    2/3

    打开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

    3/3

    在JavaScript中Math.floor() 方法执行的是向下取整的计算,它的返回值是最接近参数且不大于参数的整数。

    注意事项

    为方便预览,以上为html文件直接引入js代码效果

    JAVASCRIPT
    本文关键词:

    版权声明:

    1、本文系转载,版权归原作者所有,旨在传递信息,不代表看本站的观点和立场。

    2、本站仅提供信息发布平台,不承担相关法律责任。

    3、若侵犯您的版权或隐私,请联系本站管理员删除。

    4、文章链接:http://www.1haoku.cn/art_27667.html

    ©2019-2020 http://www.1haoku.cn/ 国ICP备20009186号07-13 02:04:55  耗时:0.035