标签:function 交集 index log js数组 == return cti var
求两个数组的交集
var arr1 = [1,2,3]; var arr2 = [2,3,4]; var arr3; arr3 = arr1.filter(function(num) { return arr2.indexOf(num) !== -1; }); console.log(arr3); //输出[2, 3]
标签:function 交集 index log js数组 == return cti var
原文地址:https://www.cnblogs.com/liyuchuan/p/10952927.html