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 :)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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 :)