Travis build: 784 [ci skip]

This commit is contained in:
Travis CI
2018-01-01 14:30:42 +00:00
parent d9a4be9f2d
commit 4caaa2a0d2
4 changed files with 52 additions and 7 deletions

View File

@ -7,6 +7,7 @@ Use the spread operator (`...`) to check if the provided argument is iterable in
```js
const isArrayLike = val =>
try {return [...val], true; }
catch (e) { return false; }

View File

@ -7,12 +7,15 @@ Omit the second argument, `power`, to use a default power of `2`.
Omit the third argument, `start`, to use a default starting value of `1`.
```js
const sumPower = (end,power = 2,start = 1) =>
Array(end + 1 - start).fill(0).map((x,i) => (i+start) ** power).reduce((a,b) => a+b,0)
const sumPower = (end, power = 2, start = 1) =>
Array(end + 1 - start)
.fill(0)
.map((x, i) => (i + start) ** power)
.reduce((a, b) => a + b, 0);
```
```js
sumPower(10); // 385
sumPower(10,3); //3025
sumPower(10,3,5); //2925
sumPower(10, 3); //3025
sumPower(10, 3, 5); //2925
```