function round
round(num: number): number

Rounds a number to the nearest integer.

Examples

Example 1

round(null) // 0
round(1.2); // 1
round(1.5); // 2
round(1.8); // 2
round(2.2); // 2
round(2.5); // 3
round(2.8); // 3

Parameters

num: number

Return Type

number

Usage

import { round } from ".";