Math.round()

Get the value of a number rounded to the nearest integer.

Signature

Math.round(x: Number, precision: Number) => Number

Description

Gets the value of a number rounded to the nearest integer.

Parameters

Parameter Type Required Description

x

Number

Yes

Number to round.

precision

Number

Yes

Number of decimal places to round to. If precision is negative, the method rounds to the left of the decimal point by the specified number of places.

Return value

Type Description

Number

Value of x rounded to the specified precision.

Examples

Math.round(19.51555, 2)
19.52

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!