Maine,
function printPrime(limit) {
var result = [2], // вот)
isPrime = false,
number = 3, //и вот)
checkNumber = Math.floor(Math.sqrt(limit));
console.log(checkNumber);
for (number; number < limit; number+=2) {
for (i = 2; i <= checkNumber; i++) {
if(number%i == 0 && number != i) {
isPrime = false;
break;
} else {
isPrime = true;
}
}
if (isPrime) {
result.push(number);
}
}
console.log(result);
}