ArrayUtils.findClosest()

<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)
doc_phaser
2017-02-14 10:36:17
Comments
Leave a Comment

Please login to continue.