HomeGorakh Raj Joshi

Array Intersection

function arrInt(arrOne, arrTwo) {
  const arrOneSet = new Set(arrOne);

  return arrTwo.filter((el) => arrOneSet.has(el));
}
arrInt([1, 2, 3], [2, 3, 4]);

Gorakh Raj Joshi

Senior Fullstack Engineer: Specializing in System Design and Architecture, Accessibility, and Frontend Interface Design

LinkedIn

GitHub

Email

All rights reserved © Gorakh Raj Joshi 2025