compareArrays Function

Compare two arrays of the same type T using the specified compare function to compare each pair of array elements.

compareArrays<T>(lhs: ReadonlyArray<T>, rhs: ReadonlyArray<T>, compare: (a: T, b: T) => number): number

@returns 0 if the arrays have the same length and compare returns 0 for each pair of elements, or a non-zero value if the arrays differ in length or contents.

Parameter Type Description
lhs ReadonlyArray<T>  
rhs ReadonlyArray<T>  
compare (a: T, b: T) => number  

Returns - number

0 if the arrays have the same length and compare returns 0 for each pair of elements, or a non-zero value if the arrays differ in length or contents.

Defined in

Last Updated: 26 April, 2025