Get the number of an array of numbers closest to a passed number
When there is a condition that,
two number have same difference to 'num',
the previous one will be returned.
Reference: https://stackoverflow.com/questions/8584902/get-closest-number-out-of-array
Parameters:
Name | Type | Description |
---|---|---|
num |
The passed number | |
numbers |
The array of numbers |