The Union Set

MediumAcc. 91.4%
+30 XP 12

Complete Collection

Your goal is to print a value if it appears in either array, but only once.

The Assignment

Your function receives arr1 and arr2.

  1. Print all unique elements from arr1.
  2. For arr2, only print an element if it was not already in arr1.

01EXAMPLE 1

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

Explanation: 1, 2, 3 are unique.

Constraints

  • Do not use Set().
ArraysSet Logic
JavaScript
Loading...
1 Hidden

Input Arguments

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

Expected Output

1
2
3

Click RUN to test your solution