Which of the following functions returns the number downwards to its nearest?
JavaScript Math.round( ) function Show
Improve Article Save Article Like Article
Improve Article Save Article JavaScript Math.round( ) function is used to round the number passed as a parameter to its nearest integer. Syntax: Math.round(value) Parameters:
Example 1: Rounding Off a number to its nearest integer To round off a number to its nearest integer, the math.round() function should be implemented in the following way: Javascript
Number after rounding : 64 Output: Number after rounding : -6 Example 3: Math.round() function, when a parameter has “.5” as a decimal Below program shows the result of Math.round() function when the parameter has “.5” as a decimal. Javascript
|