how does second.indexOf(first[i]) being ===-1 return the symmetric difference. What does the -1 mean in this situation. I think I remember -1 meaning that that it’s not a position in the array because it’s not there. Please help me understand this a bit better thank you.
**Your code so far**
function diffArray(arr1, arr2) {
let myArr=[];
function wowArray(first, second){
for(let i = 0; i < first.length; i++){
if (second.indexOf(first[i]) === -1){
myArr.push(first[i])
}
}
}
wowArray(arr1,arr2)
wowArray(arr2,arr1)
return myArr
}
console.log(diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]));
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36
Challenge: Diff Two Arrays
Link to the challenge: