From bd9aebfa611d6903218afbe54a5abfef6f045591 Mon Sep 17 00:00:00 2001 From: "sigonasr2, Sig, Sigo" Date: Tue, 14 Dec 2021 20:29:09 +0000 Subject: [PATCH] Add exponents. --- equations/src/App.js | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/equations/src/App.js b/equations/src/App.js index 6d9359f..774e18a 100644 --- a/equations/src/App.js +++ b/equations/src/App.js @@ -58,7 +58,7 @@ function EquationGroup(p) { setMyArr(eqArr) }}>Add Operator
- {arr.map((eq,i)=>Array.isArray(eq)?:eq==="×"||eq==="-"||eq==="+"||eq==="÷"?:)} + {arr.map((eq,i)=>Array.isArray(eq)?:eq==="×"||eq==="-"||eq==="+"||eq==="÷"||eq==="^"?:)} @@ -78,7 +78,7 @@ function EquationOperator(p) { },[op]) return
@@ -117,30 +117,39 @@ function Equation(p) { newEq.splice(i,1,SolveEquation(newEq[i])) } } - //Multiplication and Division first. + //Exponents first. for (i=1;iAdd Operator

- {equation.map((eq,i)=>Array.isArray(eq)?:eq==="×"||eq==="-"||eq==="+"||eq==="÷"?:)} + {equation.map((eq,i)=>Array.isArray(eq)?:eq==="×"||eq==="-"||eq==="+"||eq==="÷"||eq==="^"?:)}

{SolveEquation(equation).toFixed(2)}