diff --git a/snippets/lcm.md b/snippets/lcm.md index 9f8085d61..215158c30 100644 --- a/snippets/lcm.md +++ b/snippets/lcm.md @@ -7,10 +7,10 @@ The GCD formula uses recursion. ```js const lcm = (...arr) => { -let data = [].concat(...arr) -const gcd = (x, y) => (!y ? x : gcd(y, x % y)); -const helperLcm = (x, y) => x * y / gcd(x, y); -return arr.reduce((a, b) => helperLcm(a, b)) + let data = [].concat(...arr); + const gcd = (x, y) => (!y ? x : gcd(y, x % y)); + const helperLcm = (x, y) => x * y / gcd(x, y); + return arr.reduce((a, b) => helperLcm(a, b)) } ```