Tell us what’s happening:
Hi. Freecodecampers
i got dropElements([1, 2, 3, 9, 2], function(n) {return n > 2;}) should return [3, 9, 2]
. but it’s quite clear that the last element on the suggested returned array does not meet the func criteria (2 > 2 ?!).
Did i miss something?
Your code so far
function dropElements(arr, func) {
// Drop them elements.
return arr.filter(element => func(element));
}
console.log(dropElements([1, 2, 3, 4], function(n) {return n >= 3;}));
console.log(dropElements([1, 2, 3, 9, 2], function(n) {return n > 2;}));
dropElements([1, 2, 3], function(n) {return n < 3; });
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36
.
Link to the challenge: