While loop evaluates to false when it shouldn't

Hello y’all! I am working on Intermediate Algorithm Scripting: Drop it. My code passes all the tests except one. Here is my code:

function dropElements(arr, func) {
var newArr = arr;
//while the function is false for array item n, remove item n and start again.
while(!func(n)){
newArr.shift();
var n = newArr[0];
console.log(newArr);
}
   
//if the function returns true, stop the loop and return the rest of the array.
return newArr; 
  }
 
dropElements([1, 2, 3], function(n) {return n > 0;});

My code works great until the above arguments are put in. Why? It should see that the first array item, 1, is greater than 0. Then it should skip the while statement and just return the array. Am I misunderstanding how while loops work?
Thank you in advance for your help!

(FYI I’m using Chrome currently.)

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36.

Challenge: Drop it

Link to the challenge:

Never mind, I found the answer. It’s because I didn’t declare var n = newArr[0] before the loop started. I also had added n=newArr[0] to the while loop:

function dropElements(arr, func) {
var newArr = arr;
var n = newArr[0]
//while the function is false for array item n, remove item n and start again.
while(!func(n)){
newArr.shift();
n = newArr[0];
console.log(newArr);
}
   
//if the function returns true, stop the loop and return the rest of the array.
return newArr; 
  }
 


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