DEV Community

Discussion on: Leetcode - Intersection of Two Arrays (with JavaScript)

Collapse
 
pinceladasdaweb profile image
Pedro Rogério

Shorter version:

const intersection = (arr1, arr2) => [...new Set(arr1)].filter(x => new Set(arr2).has(x))