Returns the candidate whose distance to target is smallest, or null when candidates is empty. Ties resolve to the earliest candidate.
target
null
candidates
Returns the candidate whose distance to
targetis smallest, ornullwhencandidatesis empty. Ties resolve to the earliest candidate.