Skip to main content

belowBelow is an example

  let firstArry=[1,2,3,4,5]
   let secondArray=[2,3]        
   firstArry.filter((a) => secondArray.indexOf(a)<0);    
   //above line gives [1,4,5]

let firstArray=[1,2,3,4,5];
let secondArray=[2,3];  
let filteredArray = firstArray.filter((a) => secondArray.indexOf(a)<0);
console.log(filteredArray); //above line gives [1,4,5]

below is an example

  let firstArry=[1,2,3,4,5]
   let secondArray=[2,3]        
   firstArry.filter((a) => secondArray.indexOf(a)<0);    
   //above line gives [1,4,5]

Below is an example

let firstArray=[1,2,3,4,5];
let secondArray=[2,3];  
let filteredArray = firstArray.filter((a) => secondArray.indexOf(a)<0);
console.log(filteredArray); //above line gives [1,4,5]

Source Link
Sagar M
  • 1.4k
  • 15
  • 11

below is an example

  let firstArry=[1,2,3,4,5]
   let secondArray=[2,3]        
   firstArry.filter((a) => secondArray.indexOf(a)<0);    
   //above line gives [1,4,5]