📅  最后修改于: 2022-03-11 15:02:36.544000             🧑  作者: Mango
var toBeFiltered = [1,2,3,4,5,6];
var elements = [6,3,2];
var filteredElements = toBeFiltered.filter(
function(e) {
return this.indexOf(e) >= 0;
},
elements
);
console.log(toBeFiltered);
console.log(elements);
console.log(filteredElements);