Tell us what’s happening:
I am so lost in most of these exercises, and even more, I completely don’t understand what the question is saying let alone attempt to solve the problems. By the way, not just this question alone but most of the questions.
Your code so far
function dropElements(arr, func) {
return arr;
}
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/85.0.4183.102 Safari/537.36.
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 also given a func, a function that returns true or false
you need to remove elements starting from the first element in the array, until you find one element that returns true
Then return the rest of the array once the condition is satisfied,
once you find the first element that passed in the function returns true you stop removing elements, and return the remaining array, whichc contains the first element for which the function returns true and all the following ones
otherwise, arr should be returned as an empty array.
if no element passed in the function func returns true, then the output should just be an empty array []