Update calculator.js
This commit is contained in:
parent
ee8f672bdd
commit
d3412c1423
1 changed files with 3 additions and 2 deletions
|
@ -10,8 +10,9 @@ function sum(array) {
|
|||
return array.reduce((current, total) => total + current, 0);
|
||||
}
|
||||
|
||||
function multiply(array) {
|
||||
return array.reduce((current, total) => total * current, 1);
|
||||
function multipy (array) {
|
||||
return array.length
|
||||
? array.reduce((accumulator, nextItem) => accumulator * nextItem): 0;
|
||||
}
|
||||
|
||||
function power(a, b) {
|
||||
|
|
Loading…
Reference in a new issue