|
|
@ -7,7 +7,9 @@ Create three functions : |
|
|
|
- `adder` that receives an array and adds its elements. |
|
|
|
- `adder` that receives an array and adds its elements. |
|
|
|
|
|
|
|
|
|
|
|
- `sumOrMul` that receives an array and adds or multiplies 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. |
|
|
|
- `funcExec` that receives an array of functions and executes them. |
|
|
|
|
|
|
|
|
|
|
@ -17,9 +19,9 @@ initial value for the functions execution. |
|
|
|
Example: |
|
|
|
Example: |
|
|
|
|
|
|
|
|
|
|
|
```js |
|
|
|
```js |
|
|
|
sumOrMul([1, 2, 3, 4], 5) |
|
|
|
sumOrMul([1, 2, 3, 5, 8], 5) |
|
|
|
// -> (((5 + 1) * 2) + 3) * 4 |
|
|
|
// -> ((((5 + 1) * 2) + 3) + 5) * 8 |
|
|
|
// -> 60 |
|
|
|
// -> 160 |
|
|
|
```` |
|
|
|
```` |
|
|
|
|
|
|
|
|
|
|
|
#### Special instruction |
|
|
|
#### Special instruction |
|
|
|