A Pen by zakariamouhid

Thumbnail
This awesome code was written by zakariamouhid, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright zakariamouhid ©
  • HTML
  • CSS
  • JavaScript
    

/*Downloaded from https://www.codeseek.co/zakariamouhid/a-pen-by-zakariamouhid-wgBOKP */
    


/*Downloaded from https://www.codeseek.co/zakariamouhid/a-pen-by-zakariamouhid-wgBOKP */
    function isPrime(n) {
  var i, sqrtN = Math.sqrt(n);
  for (i = 2; i <= sqrtN; i += 1) {
    if (n % i === 0) {
      return false;
    }
  }
  return true;
}
function isEven(n) {
  return n % 2 === 0;
}
function isOdd(n) {
  return !isEven(n);
}
var n = 3;
isPrime(n) && console.log(n, "is prime number");
isEven(n) && console.log(n, "is even number");
isOdd(n) && console.log(n, "is odd number");

Comments