How to filter an array from all elements of another array How to filter an array from all elements of another array arrays arrays

How to filter an array from all elements of another array


I would do as follows;

var arr1 = [1,2,3,4],    arr2 = [2,4],    res = arr1.filter(item => !arr2.includes(item));console.log(res);