From c284d94b667951852469d97839956a37bec270ce Mon Sep 17 00:00:00 2001 From: utsav Date: Fri, 25 Mar 2022 21:22:35 +0530 Subject: [PATCH 1/7] Fixed a typo where the commenting was wrong --- Bit-Manipulation/SetBit.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Bit-Manipulation/SetBit.js b/Bit-Manipulation/SetBit.js index f7774dd54f..5c5984304e 100644 --- a/Bit-Manipulation/SetBit.js +++ b/Bit-Manipulation/SetBit.js @@ -7,7 +7,7 @@ * bit binary representations of the number and * returns a number after comparing each bit. * - * 0 | 0 -> 0 + * 0 | 0 -> 0 * 0 | 1 -> 1 * 1 | 0 -> 1 * 1 | 1 -> 1 @@ -20,7 +20,7 @@ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_OR */ -/** +/* * @param {number} number * @param {number} bitPosition - zero based. * @return {number} From 19b9cb2e24bdc9011a6df1dbe74f7c3fbaf0f963 Mon Sep 17 00:00:00 2001 From: utsav Date: Sat, 26 Mar 2022 17:59:46 +0530 Subject: [PATCH 2/7] optimised code --- Maths/FindLcm.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Maths/FindLcm.js b/Maths/FindLcm.js index 0d09a7affb..18723cba50 100644 --- a/Maths/FindLcm.js +++ b/Maths/FindLcm.js @@ -26,11 +26,7 @@ const findLcm = (num1, num2) => { let maxNum let lcm // Check to see whether num1 or num2 is larger. - if (num1 > num2) { - maxNum = num1 - } else { - maxNum = num2 - } + maxNum = Math.max(num1, num2) lcm = maxNum while (true) { From 7d4160d29ab9dc4d39aad3f92b8879419073f6fc Mon Sep 17 00:00:00 2001 From: Utsav Meena <95152531+utsav0@users.noreply.github.com> Date: Sun, 27 Mar 2022 13:11:59 +0530 Subject: [PATCH 3/7] Update SetBit.js --- Bit-Manipulation/SetBit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bit-Manipulation/SetBit.js b/Bit-Manipulation/SetBit.js index 5c5984304e..0f414fb2a4 100644 --- a/Bit-Manipulation/SetBit.js +++ b/Bit-Manipulation/SetBit.js @@ -7,7 +7,7 @@ * bit binary representations of the number and * returns a number after comparing each bit. * - * 0 | 0 -> 0 + * 0 | 0 -> 0 * 0 | 1 -> 1 * 1 | 0 -> 1 * 1 | 1 -> 1 From a1a5b658ed348117d79abc90a0587849f65f77e6 Mon Sep 17 00:00:00 2001 From: Utsav Meena <95152531+utsav0@users.noreply.github.com> Date: Sun, 27 Mar 2022 13:26:26 +0530 Subject: [PATCH 4/7] Update SetBit.js --- Bit-Manipulation/SetBit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bit-Manipulation/SetBit.js b/Bit-Manipulation/SetBit.js index 0f414fb2a4..f7774dd54f 100644 --- a/Bit-Manipulation/SetBit.js +++ b/Bit-Manipulation/SetBit.js @@ -20,7 +20,7 @@ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_OR */ -/* +/** * @param {number} number * @param {number} bitPosition - zero based. * @return {number} From 09f784eccd4441096c0faf8598a6786d48c6f0e4 Mon Sep 17 00:00:00 2001 From: Utsav Meena <95152531+utsav0@users.noreply.github.com> Date: Sun, 27 Mar 2022 13:27:16 +0530 Subject: [PATCH 5/7] Update FindLcm.js --- Maths/FindLcm.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Maths/FindLcm.js b/Maths/FindLcm.js index 18723cba50..838a3191b1 100644 --- a/Maths/FindLcm.js +++ b/Maths/FindLcm.js @@ -22,12 +22,10 @@ const findLcm = (num1, num2) => { if (num1 !== Math.round(num1) || num2 !== Math.round(num2)) { return 'Please enter whole numbers.' } - - let maxNum - let lcm + // Check to see whether num1 or num2 is larger. - maxNum = Math.max(num1, num2) - lcm = maxNum + let maxNum = Math.max(num1, num2) + let lcm = maxNum while (true) { if (lcm % num1 === 0 && lcm % num2 === 0) break From 42cec883d5c314ef7fcb13aaa8293f126dd87011 Mon Sep 17 00:00:00 2001 From: Utsav Meena <95152531+utsav0@users.noreply.github.com> Date: Mon, 28 Mar 2022 13:17:03 +0530 Subject: [PATCH 6/7] Replaced let with const --- Maths/FindLcm.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Maths/FindLcm.js b/Maths/FindLcm.js index 838a3191b1..acd1bdf010 100644 --- a/Maths/FindLcm.js +++ b/Maths/FindLcm.js @@ -24,7 +24,7 @@ const findLcm = (num1, num2) => { } // Check to see whether num1 or num2 is larger. - let maxNum = Math.max(num1, num2) + const maxNum = Math.max(num1, num2) let lcm = maxNum while (true) { From 5fe6169fcbfb0424df716adc082e3788658297b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20M=C3=BCller?= <34514239+appgurueu@users.noreply.github.com> Date: Wed, 27 Apr 2022 14:47:32 +0200 Subject: [PATCH 7/7] Remove trailing spacing Co-authored-by: merelymyself <88221256+merelymyself@users.noreply.github.com> --- Maths/FindLcm.js | 1 - 1 file changed, 1 deletion(-) diff --git a/Maths/FindLcm.js b/Maths/FindLcm.js index acd1bdf010..78f6430134 100644 --- a/Maths/FindLcm.js +++ b/Maths/FindLcm.js @@ -22,7 +22,6 @@ const findLcm = (num1, num2) => { if (num1 !== Math.round(num1) || num2 !== Math.round(num2)) { return 'Please enter whole numbers.' } - // Check to see whether num1 or num2 is larger. const maxNum = Math.max(num1, num2) let lcm = maxNum