File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ const operators = document.querySelectorAll("[data-operator]");
44const operatorRegex = / [ \/ * \- + ] / ;
55const ZERO = 0 ;
66const ZERO_DOT = '0.' ;
7+ const history = [ ] ;
78
89let data = [ ] ;
910
@@ -181,7 +182,10 @@ function userClicksOnEqualButton(button) {
181182 screen . innerText = "0÷0 is an invalid format. Press AC" ;
182183 } else {
183184 let result = eval ( replacedArray . join ( "" ) ) ;
184- console . log ( result ) ;
185+ replacedArray . splice ( replacedArray . length , 0 , "=" , result ) ;
186+ history . push ( replacedArray . join ( "" ) )
187+ console . log ( history ) ;
188+
185189 displayResult ( replacedArray , result ) ;
186190 screen . innerText = ! Number . isFinite ( result ) ? "You cannot divide by zero. Press AC" : result ;
187191 // divideByZero(screen, result);
You can’t perform that action at this time.
0 commit comments