antiprime
    Preparing search index...

    Function isPrime

    • Determines whether a number is prime.

      Parameters

      • n: number

        A number within the safe integer range.

      Returns boolean

      true if the absolute value of n is prime; otherwise false.

      Negative numbers are judged by their absolute value. Non-integers are never prime.

      TypeError If n is not a number.

      RangeError If n is NaN, infinite, or larger in magnitude than Number.MAX_SAFE_INTEGER.

      1.0.0

      isPrime(97); // true
      isPrime(-7); // true
      isPrime(10.5); // false