Tell us what’s happening:
Why isn’t this working?
Your code so far
function diffArray(arr1, arr2) {
var newArr = []
for (let i = 0 ; i < arr1.length; i++){
if (arr1.includes(arr2[i]) == false){
newArr.unshift(arr2[i])
}
}
return newArr
}
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; rv:82.0) Gecko/20100101 Firefox/82.0
.
Challenge: Diff Two Arrays
Link to the challenge: