I know their is no official way to solve a problem, but i’d love to see yours. My way solves the tests, but I feel like it could be more clever.
function diffArray(arr1, arr2) {
newArr =[];
newArr2=[];
//gets comparisons for arr1
for(i=0; i < arr1.length; i++){
if(arr2.indexOf(arr1[i]) == -1 ){
newArr.push(arr1[i]);
}
newArr
}
// gets comparisons for arr2
for(i=0; i < arr2.length; i++){
if(arr1.indexOf(arr2[i]) == -1 ){
newArr2.push(arr2[i]);
}
newArr2
}
var x = newArr.concat(newArr2);
return x;
}