Tell us what’s happening:
When I run my code I get the following error:
TypeError: [object Array] is not a function
All of the documentation I can find on reduce says the fourth parameter of the callback function should be the array reduce is called on. So there shouldn’t be a problem but this appears to be causing the trouble.
Your code so far
function sym() {
var all = Array.prototype.slice.call(arguments);
return all.reduce(function(accum,ele,ind,arr){
if(arr.findIndex(ele) == arr.lastIndexOf(ele))
return accum.append(ele);
else
return accum;
}, []);
}
sym([1, 2, 3], [5, 2, 1, 4]);
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Linux; Android 8.1.0; Pixel XL Build/OPM1.171019.016) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.137 Mobile Safari/537.36
.
Link to the challenge:
https://www.freecodecamp.org/challenges/symmetric-difference