Update calculator-solution.js

This commit is contained in:
fruddenfeldt 2023-06-07 19:58:54 +02:00 committed by GitHub
parent 80f7881a26
commit 175ee761e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,12 +11,12 @@ const sum = function (array) {
};
const multiply = function(...args){
let sum = 1
for (let i = 0; i < args.length; i++) {
sum *= args[i]
}
return sum
}
let product = 1;
for (let i = 0; i < args.length; i++) {
product *= args[i];
}
return product;
};
const power = function (a, b) {
return Math.pow(a, b);