Syntax
Definition
Have any doubt, feel free to comment here!
Math.floor(x)
, Math.round(x)
Definition
Math.floor(x)
andMath.round(x)
expects floating number as parameter.Math.floor(x)
- The floor() method rounds a number DOWNWARDS to the nearest integer, and returns the result.
- If the passed argument is an integer, the value will not be rounded.
Math.round(x)
- The round() method rounds a number to the nearest integer.
Math.floor(x)
- If the parameter is 3.51, it will be rounded DOWNWARDS (out put 3).
Math.round(x)
- If the parameter is 3.49, it will be rounded DOWNWARDS (out put 3).
- If the parameter is 3.50, it will be rounded UPWARDS (out put 4).
Have any doubt, feel free to comment here!
Syntax
Definition
Have any doubt, feel free to comment here!
Math.floor(x)
, Math.round(x)
Definition
Math.floor(x)
andMath.round(x)
expects floating number as parameter.Math.floor(x)
- The floor() method rounds a number DOWNWARDS to the nearest integer, and returns the result.
- If the passed argument is an integer, the value will not be rounded.
Math.round(x)
- The round() method rounds a number to the nearest integer.
Math.floor(x)
- If the parameter is 3.51, it will be rounded DOWNWARDS (out put 3).
Math.round(x)
- If the parameter is 3.49, it will be rounded DOWNWARDS (out put 3).
- If the parameter is 3.50, it will be rounded UPWARDS (out put 4).
Have any doubt, feel free to comment here!
No Comment