First, let's take a look at The definition of three functions in JavaScript: The Definitive Guide, 4th Edition.
Math. ceil (): roundNumber up
Arguments: Any numeric value or expression
Returns: The closest integer greater than or equalX.
Bytes -----------------------------------------------------------------------------------------------
Math. floor (): roundNumber down
Arguments: Any numeric value or expression
Returns: The closest integer less than or equalX.
Bytes -----------------------------------------------------------------------------------------------
Math. round (): round toNearest integer
Arguments: Any number.
Returns: The integer closestX.
In the past, the use of the three functions has been confusing. Now, by understanding the prototype definition of the three functions, it is easy to remember the three functions.
Now let's make a summary:
1. Math. ceil () is used as the rounded up integer.
2. Math. floor () is used for downgrading.
3. Math. round () the rounding round we often use in mathematics.