判断数组中被删除的部分 - davy-gan/web GitHub Wiki

getDeletes(arr1, arr2) {
    console.log(this);
    const result = [];
    for (let i = 0; i < (arr1 || []).length; i++) {
      const obj = arr1[i];
      const id = obj.id;
      let isExist = false;
      for (let j = 0; j < (arr2 || []).length; j++) {
        const aj = arr2[j];
        const n = aj.id;
        if (n === id) {
          isExist = true;
          break;
        }
      }
      if (!isExist) {
        result.push(obj);
      }
    }
    console.log(result);
    return result;
  }