Skip to content

Instantly share code, notes, and snippets.

@KakoozaJerry
Created January 23, 2021 08:19
Show Gist options
  • Save KakoozaJerry/3970277bbded4e8263ee0912e2eeb353 to your computer and use it in GitHub Desktop.
Save KakoozaJerry/3970277bbded4e8263ee0912e2eeb353 to your computer and use it in GitHub Desktop.
const firstArray = [4, 9, 5];
const secondArray = [9,4,9,8,4];
let intersection = firstArray.filter((el) => { return secondArray.includes(el); });
console.log(intersection)
@KakoozaJerry
Copy link
Author

This is a function to allow us return a set of intersection elements within two sets and be able to find common elements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment