jadjoubran / codetogo.io

🚀 JavaScript code to go - Find updated snippets for common JavaScript use cases
https://codetogo.io
MIT License
233 stars 30 forks source link

Use Case Suggestion: How to determine intersection between two arrays #312

Open tremendus opened 1 year ago

tremendus commented 1 year ago
const arrayOne = [ 1, 2, 3, 4, 5 ]
const arrayTwo = [ 4, 5, 6, 7 ]
const intersection = arrayOne.filter(item => arrayTwo.includes(item))