euler87: const statt let für limit nutzen
Die Variable soll sich nie ändern, weshalb const besser ist.
This commit is contained in:
parent
6987013290
commit
18a6fd4a17
2 changed files with 2 additions and 2 deletions
|
@ -48,7 +48,7 @@ Array.prototype.cross = function (other, op) {
|
||||||
// print([1, 2].cross([3, 4], (a, b) => a + b));
|
// print([1, 2].cross([3, 4], (a, b) => a + b));
|
||||||
|
|
||||||
let primeNumbers = [2,3,5,7,11,13,17,19];
|
let primeNumbers = [2,3,5,7,11,13,17,19];
|
||||||
let limit = 5e7;
|
const limit = 5e7;
|
||||||
|
|
||||||
for (let num = primeNumbers[primeNumbers.length - 1] + 2;
|
for (let num = primeNumbers[primeNumbers.length - 1] + 2;
|
||||||
num <= Math.sqrt(limit); num += 2) {
|
num <= Math.sqrt(limit); num += 2) {
|
||||||
|
|
|
@ -74,7 +74,7 @@ let primeNumbers;
|
||||||
|
|
||||||
// print(Array.from(function* () { for (let x of primeNumbers()) { if (x > 50) return; yield x; } }()));
|
// print(Array.from(function* () { for (let x of primeNumbers()) { if (x > 50) return; yield x; } }()));
|
||||||
|
|
||||||
let limit = 5e7;
|
const limit = 5e7;
|
||||||
|
|
||||||
function* pnPower(exp) {
|
function* pnPower(exp) {
|
||||||
for (let e of primeNumbers()) {
|
for (let e of primeNumbers()) {
|
||||||
|
|
Reference in a new issue