Problem 7: 10001st prime; whats wrong with the code

Tell us what’s happening:

I Guess the problem is the number can’t be stored in the variable due to length.
what are your thoughts?

Your code so far


function nthPrime(n) {
  // Good luck!
  let count = 0;
  let prime = 2;
  let stoploop = 0;
  for(let i = 2; count != n; i++){
    for(let j = 2; j <= i/2; j++){
      if(i % j === 0){
        stoploop++;
        break;
      }
    }
    if(stoploop === 0){
      count++;
      prime = i;
    }
    stoploop = 0;
  }
  return prime;
}

console.log(nthPrime(100));

Your browser information:

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

Link to the challenge:

I am Having same problem in next problem;