js small and medium to take integers up down to take integers rounding to take integers to achieve of must see article

  • 2021-07-21 06:38:34
  • OfStack

js small and medium to take integer up, down to take integer, 4 rounding 5 integer into the realization.

1. ceil () up-------ceil English means: ceiling-------------------------------------------------

2. floor () Down-------ceil English means: Ground-----is under

3. round () 4 round 5 in------ceil English means: about------is near

Look directly at the following example, and the result 1 is clear. Below the code is the corresponding print result.

Math.floor(3/4)
0
Math.floor(1/4)
0
Math.ceil(1/4)
1
Math.ceil(3/4)
1
Math.round(3/4)
1
Math.round(1/4)
0


Related articles: