Skip to content

Instantly share code, notes, and snippets.

@hkasera
Created January 31, 2016 11:36
Show Gist options
  • Select an option

  • Save hkasera/6221301829becc0f240f to your computer and use it in GitHub Desktop.

Select an option

Save hkasera/6221301829becc0f240f to your computer and use it in GitHub Desktop.
JavaScript Questions
var checkPrime = function(n) {
"use strict";
if (n === 1) {
return false;
}
var isPrime = true;
for (let i = 2; i < n;) {
if (n % i === 0) {
isPrime = false;
}
if (n > 3) {
i = i + 2;
} else {
i++;
}
}
return isPrime;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment