Tell us what’s happening:
I can’t understand why my code works in Chrome and in the Eloquent Javascript sandbox but not here. Could someone explain it, please?
Your code so far
function diffArray(arr1, arr2) {
var newArr = [];
for (i of arr1){
if (!arr2.includes(i)){
newArr.push(i)
}
}
for (j of arr2){
if (!arr1.includes(j)){
newArr.push(j)
}
}
return newArr;
}
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/76.0.3809.100 Safari/537.36
.
Link to the challenge: