题解 | #判断质数#
判断质数
https://www.nowcoder.com/practice/b936f737e2b34b3199a7c875446edd06
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> </head> <body> <script type="text/javascript"> // 补全代码 Number.prototype._isPrime = function () { let n = this.valueOf(); for (let i = 2; i < Math.sqrt(n); i++) { if (n % i == 0) return false; } return true; }; </script> </body> </html>