mirror of
https://github.com/10h30/odin-javascript-exercises.git
synced 2026-06-05 15:09:09 +09:00
Update calculator.js
This commit is contained in:
@@ -10,8 +10,9 @@ function sum(array) {
|
|||||||
return array.reduce((current, total) => total + current, 0);
|
return array.reduce((current, total) => total + current, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
function multiply(array) {
|
function multipy (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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user