The function used to compare two elements in an ordered data structure.
By default, it compares numbers so it must be replaced with a custom
function (via setCompareFunction
) when storing another data type.
Element a
Element b
-1
if a < b, 1
if a > b, 0
if a === b
Returns true
if a and b are equal, false
otherwise.
Element a
Element b
true
/ false
Returns true
if a is inferior to b, false
otherwise.
Element a
Element b
true
/ false
Returns true
if a is inferior or equal to b, false
otherwise.
Element a
Element b
true
/ false
Returns true
if a is superior to b, false
otherwise.
Element a
Element b
true
/ false
Returns true
if a is superior or equal to b, false
otherwise.
Element a
Element b
true
/ false
Generated using TypeDoc
A function that compares two elements a and b of the same type. It can be applied to any data type, including arrays or objects. It should return
-1
if a considered inferior to b,1
if superior, andzero
if considered equals.