added alternate solution to multiply using Exponentiation operator
This commit is contained in:
parent
fda681965e
commit
894ae2d4ce
|
@ -20,6 +20,11 @@ const power = function(a, b) {
|
||||||
return Math.pow(a, b);
|
return Math.pow(a, b);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//alternate solution using Exponentiation opertator
|
||||||
|
const power = function(a, b) {
|
||||||
|
return a ** b;
|
||||||
|
};
|
||||||
|
|
||||||
const factorial = function(n) {
|
const factorial = function(n) {
|
||||||
if (n === 0) return 1;
|
if (n === 0) return 1;
|
||||||
let product = 1;
|
let product = 1;
|
||||||
|
|
Loading…
Reference in New Issue