roundTo

Commons
stable

Round a number to a given number of decimal places using the standard half-up rule.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

value
required
number
The number to round.
places
number
0
The number of decimal places to keep. Defaults to 0 (integer rounding).

API

Return value

The value returned by this util.

The rounded number.

Usage

Examples

Ready-to-paste usage snippets.

Integer and decimal rounding

typescript