function diffArray(arr1, arr2) {
var newArr = [];
for(var i=0;i<arr1.length;i++){
if(arr2.find(arr1[i]) == -1){
newArr.push(arr1[i]);
}
}
for(var i=0;i<arr2.length;i++){
if(arr1.find(arr2[i]) == -1){
newArr.push(arr2[i]);
}
}
return newArr;
}
diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]);
Can you provide a link to the challenge?
I cannot find what is wrong, but I know it is because of this input
diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]);
but it shouldn’t do that. Maybe you can try a different approach on how you compare them?
these are simple arrays , error is in if condition
find() requires function argument ,I’m using indexOf() now,passed lesson