Browse Source

Clarify using-reduce sumOrMul descriptions

content-update
Clément 3 years ago committed by GitHub
parent
commit
2ee663e940
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      subjects/using-reduce/README.md

10
subjects/using-reduce/README.md

@ -7,7 +7,9 @@ Create three functions :
- `adder` that receives an array and adds its elements.
- `sumOrMul` that receives an array and adds or multiplies its elements
depending on whether the element is an odd or an even number.
depending on whether the element is an odd or an even number, where:
- even = multiply
- odd = add
- `funcExec` that receives an array of functions and executes them.
@ -17,9 +19,9 @@ initial value for the functions execution.
Example:
```js
sumOrMul([1, 2, 3, 4], 5)
// -> (((5 + 1) * 2) + 3) * 4
// -> 60
sumOrMul([1, 2, 3, 5, 8], 5)
// -> ((((5 + 1) * 2) + 3) + 5) * 8
// -> 160
````
#### Special instruction

Loading…
Cancel
Save