Tell us what’s happening:
I know my code is messy but it answers the questio, however I am unable to pass the task.
Even after changing the array to:
["diorite", "andesite", "grass", "dirt", "pink wool", "dead shrub"], ["diorite", "andesite", "grass", "dirt", "dead shrub"]
.
And returning the correct array, I still can’t pass this and other certain arrays.
Your code so far
function diffArray(arr1, arr2) {
let newArr = []
newArr.push(arr2.filter(num => arr1.includes(num) == false));
newArr.push(arr1.filter(num => arr2.includes(num) == false));
let filtered = newArr.filter(function (el) {
return el != 0;
});
return filtered;
}
diffArray(["diorite", "andesite", "grass", "dirt", "pink wool", "dead shrub"], ["diorite", "andesite", "grass", "dirt", "dead shrub"]);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36
.
Link to the challenge: