Type Alias Comparator<T>

Comparator<T>: ((a: T, b: T) => number)

Function that determines the order of two values.

A comparator returns one of the following:

  • A negative number if a is less than b
  • A positive number if a is greater than b
  • Zero if the two arguments are equal

Typical usages for a comparator include:

There are some comparator functions built-in with JavaScript. For example:

Type Parameters

  • T