loading...

Discussion on: Finding the Intersection of Two Arrays

Collapse
saleemmalikraja profile image
Saleem Malik

function intersection1(array1,array2){
// Use polyfill if you are concerning about IE11
//or
// go with indexOf instead of includes
return array1.filter(value => array2.includes(value));

}

intersection1([2,4,5,4] , [0,5]) // will result [5]

(: Happy coding :)