Find the difference
Create a function that takes two arrays and returns an array of the items that are unique.
Given two arrays (for example array A = [1, 2, 3]
and array B = [2, 3, 4]
), find the set of elements which are in one of the two arrays, but not in both.
The function should return an array of all the unique items. From the example above, it would return [1, 4]
, not necessarily in that order. (Order is unimportant).
Extra Credit: If you complete the problem above, refactor your solution so that the function can accept any number of arrays, or an array of arrays, rather than just two.