题解 | #判断质数#

判断质数

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 isPrime = true
                for (let i = 2; i < this - 1; i ++) {
                    if (this % i === 0) {
                        isPrime = false
                        break
                    }
                }
                return isPrime
            }
        </script>
    </body>
</html>

#23届找工作求助阵地#
全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务