Skip to content

intersection

函数描述

用于计算传入的多个数组的交集

基础用法

ts
import { intersection } from "@zhonghe/utils";

const array1 = [1, 2, 3, 4];
const array2 = [2, 3, 5, 6];
const array3 = [3, 4, 5, 6];

const result = intersection(array1, array2, array3);
console.log(result); // 3

类型声明

ts

Online Demo