Merge pull request #330 from Lucky4/fix-syntax

[FIX: #330][SNIPPETS] snippets arrayLcm part syntax
This commit is contained in:
Angelos Chalaris
2017-12-23 12:05:25 +02:00
committed by GitHub

View File

@ -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