Please tell me my errors

Tell us what’s happening:

Your code so far


function dropElements(arr, func) {
var newArr = [];
 for(var i = 0; i< arr.length; i++){
if(func(arr[i])){
 newArr.push(arr[i]);

   }
 }
 return newArr;
}

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0.

Challenge: Drop it

Link to the challenge:

you are keeping the elements that pass the test
instead, you need to find the first element that returns true and return a new array that starts from that element and includes all the following elements, doesn’t matter if they pass the test or not

1 Like