The Fauna service will be ending on May 30, 2025.

For more information on the service wind down, see our announcement and the Fauna Service End-of-Life FAQ.

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

true

Number to round.

precision

Number

true

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
\