Tell us what’s happening:
Not sure why my code is not passing bellow two conditions of the test:
Round two:
dropElements ([0, 1, 0, 1], function(n) {return n === 1;})
My code returns [1,1]. What is wrong with the result?
Round six:
dropElements([1, 2, 3, 9, 2], function(n) {return n > 2;})
My code returns [3,9]. What is wrong with the result?
Many thanks in advance.
Your code so far
function dropElements(arr, func) {
let newArr=arr.filter(x=> func(x))
console.log(newArr)
return newArr;
}
dropElements([1, 2, 3, 9, 2], function(n) {return n > 2; });
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36
.
Challenge: Drop it
Link to the challenge: