mirror of
https://github.com/10h30/odin-javascript-exercises.git
synced 2026-07-18 22:23:21 +09:00
Update calculator-solution.js
This commit is contained in:
@@ -6,12 +6,12 @@ const subtract = function (a, b) {
|
|||||||
return a - b;
|
return a - b;
|
||||||
};
|
};
|
||||||
|
|
||||||
const sum = function (...args) {
|
const sum = function (array) {
|
||||||
return args.reduce((sum, curr) => sum + curr, 0);
|
return array.reduce((total, current) => total + current, 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
const multiply = function(...args){
|
const multiply = function (array) {
|
||||||
return args.reduce((product, curr) => product * curr)
|
return array.reduce((product, current) => product * current)
|
||||||
};
|
};
|
||||||
|
|
||||||
const power = function (a, b) {
|
const power = function (a, b) {
|
||||||
|
|||||||
Reference in New Issue
Block a user