Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 19b9cb2

Browse files
committed
optimised code
1 parent c284d94 commit 19b9cb2

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

‎Maths/FindLcm.js‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ const findLcm = (num1, num2) => {
2626
let maxNum
2727
let lcm
2828
// Check to see whether num1 or num2 is larger.
29-
if (num1 > num2) {
30-
maxNum = num1
31-
} else {
32-
maxNum = num2
33-
}
29+
maxNum = Math.max(num1, num2)
3430
lcm = maxNum
3531

3632
while (true) {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /