In the first case, the passed in function says that it should return only elements of the array where it equals 1. But it is expecting at the end to return an array of [1,0,1]. Why would 0 be in that array?
In the second case, it is asking to return only elements which are larger than 2 but the end array contains 2. Isn’t that wrong?
I think you’re filtering out everything when you’re only supposed to filter from the first element until the passed in argument function is true.
You have this function call failing: dropElements([0, 1, 0, 1], function(n) {return n === 1;})
Your output is: [ 1, 1 ]
The expected output is: [1, 0, 1]
On the array argument, you need to check every element if it passes the function argument. If not, you remove the first element, then check if it passes again and so on and so forth.