Skip to content

Function: isPrime() ​

ts
function isPrime(n): boolean;

Prime check. 质数判断。

Parameters ​

ParameterTypeDescription
nnumberInteger to test / 待判断整数

Returns ​

boolean

True if prime / 是质数则为 true

Example ​

ts
isPrime(7) // => true

Since ​

1.0.0

Released under the MIT License.