<static> findClosest(value, arr) → {number}
Snaps a value to the nearest value in an array.
The result will always be in the range [first_value, last_value]
.
Parameters
Name | Type | Description |
---|---|---|
value | number | The search value |
arr | Array.<number> | The input array which must be sorted. |
Returns
number -
The nearest value found.
- Source code: utils/ArrayUtils.js (Line 172)
Please login to continue.