Travis build: 182

This commit is contained in:
Travis CI
2017-12-23 10:07:07 +00:00
parent 2856324c85
commit 54e56b32fc
2 changed files with 2 additions and 2 deletions

View File

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

View File

@ -270,7 +270,7 @@ arrayMax([1,2,4]) // -> 4
<p>Use <code>Array.reduce()</code> and the <code>lcm</code> formula (uses recursion) to calculate the lowest common multiple of an array of numbers.</p>
<pre><code class="language-js">const arrayLcm = arr =&gt;{
const gcd = (x, y) =&gt; !y ? x : gcd(y, x % y);
const lcm = (x, y) =&gt; (x*y)/gcd(x, y)
const lcm = (x, y) =&gt; (x*y)/gcd(x, y);
return arr.reduce((a,b) =&gt; lcm(a,b));
}
// arrayLcm([1,2,3,4,5]) -&gt; 60