Methods
round(number, precisionopt, nullable) → {Number}
Rounds a number to a defined precision.
Precision 0 rounds to full number.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
number |
Number | the number to round |
||
precision |
Number |
<optional> <nullable> |
0 | the number of digits after the floating point to round to |
Returns:
rounded number
- Type
- Number
Example
let roundedValue = round(666.66);
=> 667
let roundedValue = round(0.5555555, 3);
=> 0.556