From 18a6fd4a173e833e4b65b19200e10ebe0624eaa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Sommer?= Date: Fri, 17 Mar 2017 15:22:01 +0100 Subject: [PATCH] =?UTF-8?q?euler87:=20const=20statt=20let=20f=C3=BCr=20lim?= =?UTF-8?q?it=20nutzen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Die Variable soll sich nie ändern, weshalb const besser ist. --- 2017-03-14/jo-so_euler87_func.js | 2 +- 2017-03-14/jo-so_euler87_iterator.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/2017-03-14/jo-so_euler87_func.js b/2017-03-14/jo-so_euler87_func.js index ab2b7c3..f131ccb 100755 --- a/2017-03-14/jo-so_euler87_func.js +++ b/2017-03-14/jo-so_euler87_func.js @@ -48,7 +48,7 @@ Array.prototype.cross = function (other, op) { // print([1, 2].cross([3, 4], (a, b) => a + b)); let primeNumbers = [2,3,5,7,11,13,17,19]; -let limit = 5e7; +const limit = 5e7; for (let num = primeNumbers[primeNumbers.length - 1] + 2; num <= Math.sqrt(limit); num += 2) { diff --git a/2017-03-14/jo-so_euler87_iterator.js b/2017-03-14/jo-so_euler87_iterator.js index 75a0d3c..ac62135 100755 --- a/2017-03-14/jo-so_euler87_iterator.js +++ b/2017-03-14/jo-so_euler87_iterator.js @@ -74,7 +74,7 @@ let primeNumbers; // print(Array.from(function* () { for (let x of primeNumbers()) { if (x > 50) return; yield x; } }())); -let limit = 5e7; +const limit = 5e7; function* pnPower(exp) { for (let e of primeNumbers()) {