From 51b6420dfe992d808c8c9b9923777d4d10a79432 Mon Sep 17 00:00:00 2001 From: Christian Bender Date: Sat, 31 Mar 2018 18:13:18 +0200 Subject: [PATCH] added the let-statment --- Algorithms/EucledianGCD.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Algorithms/EucledianGCD.js b/Algorithms/EucledianGCD.js index 7184719d1..fb84ea5f7 100644 --- a/Algorithms/EucledianGCD.js +++ b/Algorithms/EucledianGCD.js @@ -5,7 +5,7 @@ function euclideanGCDRecursive (first, second) { :param second: Second number :return: GCD of the numbers */ - if (second === 0) { + if (second == 0) { return first; } else { return euclideanGCDRecursive(second, (first % second)); @@ -19,8 +19,8 @@ function euclideanGCDIterative (first, second) { :param second: Second number :return: GCD of the numbers */ - while (second !== 0) { - var temp = second; + while (second != 0) { + let temp = second; second = first % second; first = temp; } @@ -28,8 +28,8 @@ function euclideanGCDIterative (first, second) { } function main () { - var first = 20; - var second = 30; + let first = 20; + let second = 30; console.log('Recursive GCD for %d and %d is %d', first, second, euclideanGCDRecursive(first, second)); console.log('Iterative GCD for %d and %d is %d', first, second, euclideanGCDIterative(first, second)); }