Advertisement
Guest User

Untitled

a guest
Oct 24th, 2016
1,963
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const relativeComplement = function (array1, array2){
  2.     array2 = array2.splice(0);
  3.     return array1.filter((v,i,a) => {
  4.         let index = array2.indexOf(v);
  5.         if (index > -1) {
  6.             array2.splice(index, 1);
  7.             return false;
  8.         }
  9.         return !array2.includes(v);
  10.     });
  11. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement