Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const relativeComplement = function (array1, array2){
- array2 = array2.splice(0);
- return array1.filter((v,i,a) => {
- let index = array2.indexOf(v);
- if (index > -1) {
- array2.splice(index, 1);
- return false;
- }
- return !array2.includes(v);
- });
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement