This commit is contained in:
Rohit Tanwar
2017-12-29 17:01:22 +05:30

View File

@ -7,7 +7,7 @@ The GCD formula uses recursion.
```js
const lcm = (...arr) => {
let data = [].concat(...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))