1var toBeFiltered = [1,2,3,4,5,6];
2var elements = [6,3,2];
3var filteredElements = toBeFiltered.filter(
4 function(e) {
5 return this.indexOf(e) >= 0;
6 },
7 elements
8);
9
10console.log(toBeFiltered);
11console.log(elements);
12console.log(filteredElements);