Searches a pre-sorted array for the closet value to the given number.
If the key argument is given it will assume the array contains objects that all have the required key property name,
and will check for the closest value of those to the given number.
Parameters
value: number
The value to search for in the array.
array: any[]
The array to search, which must be sorted.
Optionalkey: string
An optional property key. If specified the array elements property will be checked against value.
Searches a pre-sorted array for the closet value to the given number.
If the
keyargument is given it will assume the array contains objects that all have the requiredkeyproperty name, and will check for the closest value of those to the given number.