Update sumPower.md

This commit is contained in:
Angelos Chalaris
2018-01-01 16:22:06 +02:00
committed by GitHub
parent f273c0c2f8
commit b380a01c8f

View File

@ -7,7 +7,7 @@ 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)
const sumPower = (end,power = 2,start = 1) =>
Array(end - start).fill(0).map((x,i) => (i+start) ** power).reduce((a,b) => a+b,0)
```