Update calculator-solution.js
This commit is contained in:
parent
80f7881a26
commit
175ee761e1
1 changed files with 6 additions and 6 deletions
|
@ -11,12 +11,12 @@ const sum = function (array) {
|
||||||
};
|
};
|
||||||
|
|
||||||
const multiply = function(...args){
|
const multiply = function(...args){
|
||||||
let sum = 1
|
let product = 1;
|
||||||
for (let i = 0; i < args.length; i++) {
|
for (let i = 0; i < args.length; i++) {
|
||||||
sum *= args[i]
|
product *= args[i];
|
||||||
}
|
}
|
||||||
return sum
|
return product;
|
||||||
}
|
};
|
||||||
|
|
||||||
const power = function (a, b) {
|
const power = function (a, b) {
|
||||||
return Math.pow(a, b);
|
return Math.pow(a, b);
|
||||||
|
|
Loading…
Reference in a new issue