es6 两个数组取相同项
let arr = [{ id: 1, name: 'zs' }, { id: 2, name: 'ls' }, { id: 3, name: 'ww' }, { id: 4, name: 'xm' }, { id: 5, name: 'xh' },] let sum = [3, 4, 5] let date = arr.filter(item => sum.indexOf(item.id) > -1) console.log('date', date) // 0: {id: 3, name: "ww"} // 1: {id: 4, name: "xm"} // 2: {id: 5, name: "xh"}