There is nothing inside of the if statement, so I don’t know what this code is intended to do.
This says arr1 === arr2, or “array one is exactly the same array in memory as array two”, which is never true in this problem.
Here you are checking if the element is exactly equal to the boolean literal value false.
Lets back up for a second here.
Lets consider arr1 = [1, 2, 5], arr2 =[1, 2, 3, 4]. What is the diff of these two arrays? How would you find that diff, step by step, using pencil and paper (no JS syntax!!)
IF items from the same index do not match,
THEN send that item into a new array
IF the following item that now finds itself on that index does not match with its counterpart,
THEN send that item to a new array, as well
What do you mean by ‘different’. That is not a full definition.
Compare two arrays and return a new array with any items only found in one of the two given arrays, but not both. In other words, return the symmetric difference of the two arrays.
As per Wikipedia, "the symmetric difference of two sets, also known as the disjunctive union, is the set of elements which are in either of the sets, but not in their intersection. For example, the symmetric difference of the sets "
I am sorry, but I just don’t understand your replies to my questions. I don’t think we are making any sense to each other. Hopefully someone else can help you.
Thanks for the help; I really made a big mess. I believe the problem was that I did not understand what the exercise was asking in the first place. I had an algorithm in my head, and for some reason I could not let go. So I thought, “I have to achieve this,” which lead me astray. Like you said, “what is diff?” and the problem is asking for symmetric difference. After I looked it up on Wikipedia, I could understand what it was. Funny because one of the first tips I got on FCC was: “understand the problem first!” Ai ai.