round
Rounds a number to the nearest integer or to specified decimal places.
round
Rounds a number to the nearest integer or to specified decimal places.
Type: transform
Parameters
- input (unknown): The input number to round.
- decimals (number?): Optional number of decimal places to round to.
Returns
Type: number
The rounded number, or NaN if input cannot be converted to a number.
Examples
round(3.7) // 4
round(3.14159, 2) // 3.14
(2.567)|round // 3