JavaScript
$u.n.round Function
Syntax
$u.n.round(value as number, decimalPlace as number, dir as string)
Arguments
- valuenumber
The number to round.
- decimalPlacenumber
The number of decimal places to keep in the rounded number.
- dirstring
(Optional) Allows you to specify the direction you want to round. dir can have one of three possible values:
Description
Round a number to a specified number of decimal places.
Discussion
Takes a number as input and rounds it to the specified number of decimal places. Returns a number.
Example
$u.n.round(23.12142342342342,1); /* result is: 23.1*/ $u.n.round(23.12,1,'u'); /* result is: 23.2*/ $u.n.round(23.18,1,'d'); /* result is: 23.1*/