File tree Expand file tree Collapse file tree 1 file changed +14
-12
lines changed
Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -203,35 +203,37 @@ function userClicksOnEqualButton(button) {
203203 screen . innerText = "0÷0 is an invalid format. Press AC" ;
204204 } else {
205205 let result = eval ( replacedArray . join ( "" ) ) ;
206- let historyEntries = [ ...replacedArray , "=" , result ] ;
206+ let historyEntries = [ [ ...replacedArray , "=" , result ] ] ;
207207 // let computationHistory = replacedArray.slice();
208+
209+ console . log ( historyEntries )
208210
209211 replacedArray . splice ( replacedArray . length , 0 , "=" , result ) ;
210212 // history.push(replacedArray.join(""));
211213
212- console . log ( historyEntries )
213- historyEntries . forEach ( entry => {
214- history . push ( entry ) ;
215- console . log ( history . join ( " " ) )
216- historyElement . innerHTML += history
217- } )
218-
219- historyElement . innerHTML += history . join ( " " )
214+
215+
220216
221217
222-
223- console . log ( history ) ;
218+
219+
224220
225221
226222 displayResult ( replacedArray , result ) ;
227223 screen . innerText = ! Number . isFinite ( result ) ? "You cannot divide by zero. Press AC" : result ;
228224 // divideByZero(screen, result);
229225 data = [ ] ;
230226 data . push ( result ) ;
227+ historyEntries . forEach ( entry => {
228+ console . log ( entry ) ;
229+ history . push ( entry ) ;
230+ console . log ( history ) ;
231+ historyElement . innerHTML += `<li>${ entry . join ( "" ) } </li>`
232+ } ) ;
231233
232234 }
233235 } catch ( e ) {
234- debugger
236+ // debugger
235237 screen . innerText = `${ e . name } press AC` ;
236238 }
237239 }
You can’t perform that action at this time.
0 commit comments