Update calculator.js

This commit is contained in:
Rhys 2018-09-28 13:35:40 +08:00 committed by GitHub
parent 7b03e764bb
commit 5156aa6611
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,7 +10,7 @@ function sum(array) {
return array.reduce((current, total) => total + current, 0);
}
function multiply (array) {
function multiply(array) {
return array.length
? array.reduce((accumulator, nextItem) => accumulator * nextItem): 0;
}