// 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73
function getTheNthPrimeNumber(nth) {
let prime = 1, count = 0, i;
while (count < nth) {
prime += 1;
for (i = 2; i <= prime; i++) {
if (prime % i === 0) {
break;
}
}
if (i === prime) {
count += 1;
}
}
return prime;
}
const nth = 8;
console.log("Nth prime: " + getTheNthPrimeNumber(nth));
/*
run:
Nth prime: 19
*/