.round(places)

Description

The round method returns the rounded version of its input value.

Parameters

If round gets no parameters, it rounds to the nearest 1. For example 10.5 will get rounded up to 11.

If round get parameter, it will round to the number of decimal points you tell it to.

Usage On Numbers

num = 10.4
// sets num to 10.4

log num.round()
// returns 10
pi = 3.1415
// sets up the pi

log pi.round(100)
// rounds pi to the nearest 100th (3.14)

Last updated