From 894ae2d4ce476ac92925da6bfc8039f8be095a4f Mon Sep 17 00:00:00 2001 From: trekitch Date: Wed, 26 Jan 2022 14:15:16 -0500 Subject: [PATCH] added alternate solution to multiply using Exponentiation operator --- calculator/calculator.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/calculator/calculator.js b/calculator/calculator.js index d45cc64..a18a527 100644 --- a/calculator/calculator.js +++ b/calculator/calculator.js @@ -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;