A、B 数组取交集

81 阅读1分钟
const truely = [1, 2, 3, 4, 5]
const s = [2, 4, 6, 8]

const checkList = truely.filter((item) => {
  return s.indexOf(item) > -1
})

console.log(checkList) // 输出 [2, 4]