Skip to content

round ​

The round() method rounds a number to the nearest integer. If the decimal part is exactly 0.5, the number is rounded to the next higher integer.

Interactive example ​

Syntax ​

typescript
function round<
	GenericInput extends number
>(
	input: GenericInput
): number

Parameters ​

  • input: The number to round.

Return value ​

The number rounded to the nearest integer.

See also ​

Sources ​

Released under the MIT license.