commit
a70a2503ab
1 changed files with 3 additions and 1 deletions
|
@ -11,7 +11,9 @@ function sum(array) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function multiply(array) {
|
function multiply(array) {
|
||||||
return array.reduce((current, total) => total * current, 1);
|
return array.length
|
||||||
|
? array.reduce((accumulator, nextItem) => accumulator * nextItem)
|
||||||
|
: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function power(a, b) {
|
function power(a, b) {
|
||||||
|
|
Loading…
Reference in a new issue