diff --git a/README.md b/README.md index 58528c68e..a64842de8 100644 --- a/README.md +++ b/README.md @@ -290,7 +290,7 @@ Use `Array.reduce()` and the `lcm` formula (uses recursion) to calculate the low ```js const arrayLcm = arr =>{ const gcd = (x, y) => !y ? x : gcd(y, x % y); - const lcm = (x, y) => (x*y)/gcd(x, y); + const lcm = (x, y) => (x*y)/gcd(x, y) return arr.reduce((a,b) => lcm(a,b)); } // arrayLcm([1,2,3,4,5]) -> 60 diff --git a/snippets/arrayLcm.md b/snippets/arrayLcm.md index 3b0ad354c..8d4e593fb 100644 --- a/snippets/arrayLcm.md +++ b/snippets/arrayLcm.md @@ -7,7 +7,7 @@ Use `Array.reduce()` and the `lcm` formula (uses recursion) to calculate the low ```js const arrayLcm = arr =>{ const gcd = (x, y) => !y ? x : gcd(y, x % y); - const lcm = (x, y) => (x*y)/gcd(x, y) + const lcm = (x, y) => (x*y)/gcd(x, y); return arr.reduce((a,b) => lcm(a,b)); } // arrayLcm([1,2,3,4,5]) -> 60