Tell us what’s happening:
Hey guys, basically I don’t pass 2 tests. the second and last one, could anyone explain me why please? Thank you
**Your code so far**
function dropElements(arr, func) {
let firstNumber;
let newArr = [];
while(arr.length !== 0) {
firstNumber = arr.shift();
console.log(firstNumber)
console.log(arr)
if (func(firstNumber)) {
newArr.push(firstNumber);
}
}
return newArr
}
dropElements([0, 1, 0, 1], function(n) {return n === 1;})
/*
iterate through arr;
remove each element that is arr[0];
check if func passes with those numbers;
if yes push into array, if no leave it as it is.
return array with passed numbers if nothing is passed rteurn an empty arr;
*/
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36
Challenge: Intermediate Algorithm Scripting - Drop it
Link to the challenge: