Es6, removes the contents of one array from another array

my code has bug, and then I checked to write = = as =

.

A [1,2,3,4,5,6,7]
B [2,3,4]

after deletion

A [1,5,6,7]



    this.selectRightTableData.forEach(item => {
      this.rightTableData.splice(this.rightTableData.findIndex(v => v.id = item.id), 1)
    })

  

after repair, judge according to an attribute of the object; whether it is the same

  
      

    this.selectRightTableData.forEach(item => {
      this.rightTableData.splice(this.rightTableData.findIndex(v => v.id == item.id), 1)
    })
  

judge by memory address

this.selectLeftTableData.forEach(item => {
      this.leftTableData.splice(this.leftTableData.indexOf(item), 1)
    })
Mar.03,2021

feel that there is no new array, yet, and then it is convenient for indexOf to add push to the new array

    const a = [1,2,3,4,5], b = [1,2],c = [];
    a.forEach( v => {
      if(b.indexOf(v) === -1) c.push(v)
    })

let A=[1,2,3,4,5,6,7];
let B=[2,3,4];
let newB=[];
for(var i=0,lenA=A.length;i<lenA;iPP){
    for(var b=0,lenB=B.length;b<lenB;bPP){
        if(A[i]!=B[b]){
            newB.push(B[b])
        }
    }
}

this can also achieve the effect you want

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e8fabd-1272.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e8fabd-1272.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?