Here's my stab at it.
Change the initial i=0
from 0 to whatever you want, and the the second i<100
from 100 to whatever to get primes in a different range.
for(var i=0; i<100; i++){
var devisableCount = 2;
for(var x=0; x<=i/2; x++){
if(i !== 1 && i !== 0 && i !== x){
if(i%x === 0){
devisableCount++;
}
}
}
if(devisableCount === 3){
console.log(i);
}
}
I tried it with 10000000
- it takes some time but appears to be accurate.