By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
What is the nth prime number?
https://dev.to/jinglescode/project-euler-problem-7-10001st-prime-l4m
You can also decrease the complexity of the algorithm from O(n) to O(sqrt(n)) if you run the loop until square root of a number: https://stackoverflow.com/questions/40200089/number-prime-test-in-javascript