Merge pull request #218 from trekitch/jest-solutions

This commit is contained in:
Michael Frank 2022-01-27 10:07:16 +13:00 committed by GitHub
commit d1c9c98366
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 the Exponentiation operator
const altPower = function(a, b) {
return a ** b;
};
const factorial = function(n) {
if (n === 0) return 1;
let product = 1;