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