Cannot pass the last test: Problem 7: 10001st prime

Tell us what’s happening:
I dont know why the last test cannot pass but other 4 tests can pass.
Help please.

Your code so far


function nthPrime(number) {
  // Good luck!

  var prime = [2];
  var i = 3;
  var count = 1;
  
  while(count != number){
  if(prime.every(item=>i%item != 0)){
      prime.push(i);
      count++;
    }
    i+=2;
  }

  return prime[prime.length-1];
}

nthPrime(10001);

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/coding-interview-prep/project-euler/problem-7-10001st-prime

your code gives the correct output but the test is timing out before it finishes - there’s a built in loop protecting that stops the tests if its taking too long - the only way around it at the moment is to make your code more efficient - this post explains it a little Free Code Camp Infinite Loop Protection, but the workaround suggestion they give doesn’t work with the new site at the moment