From 894ae2d4ce476ac92925da6bfc8039f8be095a4f Mon Sep 17 00:00:00 2001 From: trekitch Date: Wed, 26 Jan 2022 14:15:16 -0500 Subject: [PATCH 1/4] 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; From 10199f35a938bdf0a7f8ed77b8e30d7a3e7e09fb Mon Sep 17 00:00:00 2001 From: trekitch Date: Wed, 26 Jan 2022 15:03:53 -0500 Subject: [PATCH 2/4] change to alternate solutions name --- calculator/calculator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/calculator/calculator.js b/calculator/calculator.js index a18a527..c46b919 100644 --- a/calculator/calculator.js +++ b/calculator/calculator.js @@ -16,7 +16,7 @@ const multiply = function(array) { : 0; }; -const power = function(a, b) { +const altPower = function(a, b) { return Math.pow(a, b); }; From db4255dc9219bd404fb2fbc03d8059c0434345fa Mon Sep 17 00:00:00 2001 From: trekitch Date: Wed, 26 Jan 2022 15:04:37 -0500 Subject: [PATCH 3/4] changed right name this time --- calculator/calculator.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/calculator/calculator.js b/calculator/calculator.js index c46b919..c652d5d 100644 --- a/calculator/calculator.js +++ b/calculator/calculator.js @@ -16,12 +16,12 @@ const multiply = function(array) { : 0; }; -const altPower = function(a, b) { +const power = function(a, b) { return Math.pow(a, b); }; //alternate solution using Exponentiation opertator -const power = function(a, b) { +const altPower = function(a, b) { return a ** b; }; From d091aef25df4034d98e2ea037929c6d43f8a174e Mon Sep 17 00:00:00 2001 From: Trevon Kitchen Date: Wed, 26 Jan 2022 16:04:46 -0500 Subject: [PATCH 4/4] Update calculator/calculator.js accepted Co-authored-by: Michael Frank --- calculator/calculator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/calculator/calculator.js b/calculator/calculator.js index c652d5d..f03ea57 100644 --- a/calculator/calculator.js +++ b/calculator/calculator.js @@ -20,7 +20,7 @@ const power = function(a, b) { return Math.pow(a, b); }; -//alternate solution using Exponentiation opertator +//alternate solution using the Exponentiation operator const altPower = function(a, b) { return a ** b; };