Glossary: Algorithms Beyond the Basics in JavaScript
Comparator
Also written: comparator function
A function you pass to `sort` that says which of two items goes first: a negative result puts `a` first. It is needed because a bare `sort()` compares items as text, which is wrong for numbers and arrays.