diff --git a/calculator/calculator.js b/calculator/calculator.js index 6fa7dd9..2e08f49 100644 --- a/calculator/calculator.js +++ b/calculator/calculator.js @@ -11,7 +11,9 @@ function sum(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) {