remove object from 1st array if it matches with an object from second array js code example

Example 1: remove all from array that matches

var array = [1,2,'deleted',4,5,'deleted',6,7];
var newarr = array.filter(function(a){return a !== 'deleted'})

Example 2: remove one element using splice

fruits = ['Banana', 'Orange', 'Apple', 'Mango'];

removeFruitByIndex(index: number) {
  this.fruits = [
    ...this.fruits.slice(0, i),
    ...this.fruits.slice(i + 1, this.fruits.length),
  ];
}


removeFruitByValue(fruite: string) {
  const i = this.descriptionsList.indexOf(fruite);
  this.fruits = [
    ...this.fruits.slice(0, i),
    ...this.fruits.slice(i + 1, this.fruits.length),
  ];
}