How can I round down a number in Javascript?

前端 未结 11 1405
感动是毒
感动是毒 2020-11-29 23:27

How can I round down a number in JavaScript?

math.round() doesn\'t work because it rounds it to the nearest decimal.

I\'m not sure if there is

11条回答
  •  忘掉有多难
    2020-11-29 23:57

    Using Math.floor() is one way of doing this.

    More information: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/floor

提交回复
热议问题