Merge pull request #25 from 105ron/patch-1

Update calculator.js
This commit is contained in:
Cody Loyd
2019-01-11 15:10:31 -06:00
committed by GitHub
+3 -1
View File
@@ -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) {