The interval to round the number to the nearest multiple of
Optional
method: string = "round"The rounding method in: round, ceil, floor
The rounded number
let n = 17.18;
n.toNearest(5); // 15
n.toNearest(10); // 20
n.toNearest(10, "floor"); // 10
n.toNearest(10, "ceil"); // 20
n.toNearest(0.25); // 17.25
Round a number to the closest number which is a multiple of the provided interval. This is a convenience function intended to humanize issues of floating point precision. The interval is treated as a standard string representation to determine the amount of decimal truncation applied.