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
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.