Function: arraysEqualIgnoreOrder()
ts
function arraysEqualIgnoreOrder<T>(a, b): boolean;Compares two arrays for equality ignoring element order. 忽略顺序比较两个数组是否包含相同元素。
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
a | readonly T[] | First array / 第一个数组 |
b | readonly T[] | Second array / 第二个数组 |
Returns
boolean
true if arrays contain the same elements / 包含相同元素时返回 true
Example
ts
arraysEqualIgnoreOrder([1, 2, 3], [3, 2, 1]) // => trueSince
1.5.0