I dont know why my code doesnt work

Tell us what’s happening:
I think my code shoud work, but it doesnt.

Your code so far

function dropElements(arr, func) {
let final = arr.filter(num => {
  if(func(num)) {
    return num
return final

dropElements([1, 2, 3, 9, 2], function(n) {return n > 2;});

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36.

Challenge: Drop it

Link to the challenge:

Read the instructions again carefully:

Given the array arr , iterate through and remove each element starting from the first element (the 0 index) until the function func returns true when the iterated element is passed through it.

You are filtering out the values that do not return true when passed to func. That’s not what you are asked to do.

1 Like

Thank you so much !!

I’m glad I could help. Happy coding!