Advertisement
Guest User

Untitled

a guest
Oct 24th, 2016
1,126
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 0.31 KB | None
  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
RAW Paste Data Copied
Advertisement