Travis build: 615

This commit is contained in:
Travis CI
2017-12-29 14:43:26 +00:00
parent 1bf8054dd7
commit bef5b648af
2 changed files with 10 additions and 2 deletions

View File

@ -2142,7 +2142,10 @@ Returns the average of an of two or more numbers/arrays.
Use `Array.reduce()` to add each value to an accumulator, initialized with a value of `0`, divide by the `length` of the array.
```js
const average = (...arr) => [].concat(...arr).reduce((acc, val) => acc + val, 0) / arr.length;
const average = (...arr) => {
const nums = [].concat(...arr);
return nums.reduce((acc, val) => acc + val, 0) / nums.length;
};
```
<details>
@ -2150,6 +2153,7 @@ const average = (...arr) => [].concat(...arr).reduce((acc, val) => acc + val, 0)
```js
average([1, 2, 3]); // 2
average(1, 2, 3); // 2
```
</details>