Hallo: my algorithm is returning [1, 1]
but not, for example, [1, 5, 1]
. Shouldn’t it also work since in the for
loop I’m working with the length
of arr2
?
function destroyer(arr, ...arr2) {
let x = []
for(let i = arr2.length; i > 0 ; i--) {
x.push(arr.find(element => element !== arr2));
};
console.log(x)
return x;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Thanks!!