let array1 = [{id:"1"},{id:"2"},{id:"3"}]
let array2 = {id:"1"} delete array2 if there is array2 in array1, and add it if it doesn"t exist. How to judge the 
 array object? 
 what I am writing now: 
 `
  let array1 = [{id:"1"},{id:"2"},{id:"3"}]
  if(array1.length){
    for(let i=0; i<=array1 .length; iPP){  
      if(array1 [i].id == array2 .id){
        array1.splice(i,1)
      }else{
        array1.push(file)
      }
    }
  }else{
    array1.push(file)
  }`
  
  