diff --git a/calculator/calculator.app.js b/calculator/calculator.app.js index ebb251a..d619c9c 100644 --- a/calculator/calculator.app.js +++ b/calculator/calculator.app.js @@ -583,7 +583,11 @@ function buttonPress(val) { break; case '=': if (prevNumber != null && currNumber != null && operator != null) { - prevExpression = "(" + prevExpression + " " + operator + " " + currExpression + ")"; + let cExpr = currExpression; + if (hasPressedEquals && cExpr === "") { + cExpr = currNumber.toString(); + } + prevExpression = prevExpression + " " + operator + " " + cExpr; results = doMath(prevNumber, currNumber, operator); prevNumber = results; currExpression = "";