Symmetric Difference

It is not an easy activity and I am confused. Though I understand the concept behind and how it should work so logically this makes sense but when it comes to code it becomes confusing.

Problem

Create a function that takes two or more arrays and returns an array of the symmetric difference (△ or ⊕) of the provided arrays.

Approach

I assigned an empty array, a for-loop which will iterate through and push the arguments index 0 to the empty array. I created another function which takes two parameters, inside the function I assigned an empty array,I had a another function which will go inside the first array and check each an every item and an if statement which will compare the first and second array if an item exists and push it to the empty array I have created, another function which checks if is there an item that doesn’t exist in the first array.Therefore I reduced the second function, into the first array of new items are created.

Conclusion

It wasn’t definitely an easy excise to complete that easy, it was very interesting and challenging at the same time and confusing but absolutely I learned a lot from it. Though it feels like there are probably better ways because by just looking at it, it just looks so confusing one just need to go step by step to get it and fully understand what is really going on here.