return all items in one array not in another array javascript code example
Example: return elements of an array from another array javascript
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);