round()

Rounds the given number.

Used with a single parameter, it rounds to the nearest integer.

Used with two parameters, it rounds to a specific number of decimal places.

Syntax

round(value)
round(value, decimals)

Parameters

Parameter Type Description
value Number Number to be rounded.
decimals Number Decimal places to round to. optional

Return Value

Examples

round(4.6);     // returns 5
round(4.45, 1); // returns 4.5

See also

round
roundup
floor
ceil
trunc
center
centerex