Solution is not working

I wrote the same solution on the video but it gives me an error
const numbers = [1, 2, 3, 4, 5];

function except(Arr, excluded) {
let newArr = [];
for (let element of Arr) {
if (!excluded.includes(element)){
newArr.push(element)
}
}
return newArr
}
console.log(except(numbers, 3));

What error does it give you?

Your function expects an array as the second argument but you pass a number. Try replacing 3 by [3].

1 Like

Double check your function - includes is an array function.

1 Like

why does it expect an array is it because the includes an array method?

Yes. You are calling includes() on it and that is a method of the Array prototype.

1 Like