remove common elements of two arrays in jquery
client, javascript, jquery
Solution
You can filter array A by checking its elements position in array B:
C = A.filter(function(val) {
return B.indexOf(val) == -1;
});
Demo
Problem
I want to remove common elements of two arrays in jquery. I have two arrays: ``` A = [0,1,2,3] B = [2,3] ``` and result should be `[0, 1]`. Please help