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)){

  return prime[prime.length-1];


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:

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