added alternate solution to multiply using Exponentiation operator

This commit is contained in:
trekitch 2022-01-26 14:15:16 -05:00
parent fda681965e
commit 894ae2d4ce
1 changed files with 5 additions and 0 deletions

View File

@ -20,6 +20,11 @@ const power = function(a, b) {
return Math.pow(a, b);
};
//alternate solution using Exponentiation opertator
const power = function(a, b) {
return a ** b;
};
const factorial = function(n) {
if (n === 0) return 1;
let product = 1;