Function: intersection()
ts
function intersection<T>(...arrays): T[];Returns the intersection of multiple arrays. 返回多个数组的交集。
Type Parameters
| Type Parameter | Description |
|---|---|
T | The array item type / 数组元素类型 |
Parameters
| Parameter | Type | Description |
|---|---|---|
...arrays | readonly readonly T[][] | The input arrays / 输入数组 |
Returns
T[]
A new array containing shared items / 包含共有元素的新数组
Example
ts
intersection([1, 2, 3], [2, 3, 4])
// => [2, 3]Since
1.2.0