How i can pass arguments

Tell us what’s happening:

Hello, how i can pass arguments to the func in order to get true or false? Or could I solve with filter? Please don’t spoil. just tell me what I should learn. sorry for my english

Your code so far


function dropElements(arr, func) {
  let f = func;
  
  for(let i = 0 ; i < arr.length ; i++){
    **if(f(arr[i]))**{
      let newArr = arr.slice(i);
      return newArr;
    }  
  }
}
console.log(dropElements([1, 2, 3], function(n) {return n < 3; }));

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/drop-it

you can just use func(arr[i]). The problem is not accesing the function but what you are doing whit that info. The problem say keep removing items until the function return true (aka when it return false you remove when it return true you stop). But you remove the item when the function return true so you just remove one item and end the for. What about using splice instead, it removes items over the array itself.