Math.floor(),其中Math是JavaScript的一个对象,floor是Math的属性。Math.floor()可以获得一个数的整数部分,而不是四舍五入,这在编程中比较常用,比如要使用JavaScript制作一条虚线

用法实例:

<script>
document.write(Math.floor(400.0244))
</script>
运行结果是400。

<script>
document.write(Math.floor(3.8))
</script>
运行结果是3。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-24
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
猜你喜欢
  • 2021-12-07
  • 2022-12-23
  • 2022-12-23
  • 2021-12-20
  • 2022-12-23
  • 2022-12-23
  • 2021-09-26
相关资源
相似解决方案