This function takes two arrays and returns a new array containing elements that exist in both the first and second arrays.
It effectively filters out any elements that do not appear in both arrays.
Unlike lodash, this function preserves duplicate elements from the first array.
Computes the intersection between two arrays.
This function takes two arrays and returns a new array containing elements that exist in both the first and second arrays. It effectively filters out any elements that do not appear in both arrays. Unlike lodash, this function preserves duplicate elements from the first array.
计算两个数组之间的交集。
此函数接收两个数组,并返回一个新数组,其中包含同时存在于第一个数组和第二个数组中的元素。 它有效地过滤掉不在两个数组中同时出现的任何元素。 与 lodash 不同,此函数保留第一个数组中的重复元素。