Intersection Point

MediumAcc. 88.2%
+35 XP 15

Shared Identity

What items exist in both collections?

The Assignment

Your function receives arr1 and arr2.

  1. Iterate through arr1.
  2. For every element, check if it exists in arr2.
  3. If it does, print it. (Ignore duplicates for now—one print per match).

01EXAMPLE 1

Inputarr1=[1, 2], arr2=[2, 3]
Output2

Explanation: 2 is shared.

Constraints

  • Simple nested loop check.
ArraysSet Logic
JavaScript
Loading...
1 Hidden

Input Arguments

arr1[1,2,2,1]
arr2[2,2]

Expected Output

2
2

Click RUN to test your solution