Glossary: Coding Interviews in JavaScript
Comparator
Also written: compare function, compare
A function passed to `sort` or a heap that says which of two items comes first, returning a negative number when `a` goes first. For numbers you write `(a, b) => a - b`, because the default sort compares as text.