+ 1

How can I save the history of operations made in an HTML calculator?

I need to store the operations done and show them in the Calculator. Does anyone know?

7th Oct 2018, 5:28 PM
Dante M
3 ответов
+ 2
well, I added function calling from the equal button (called makeHistory(result) ) line 32-34 with semicolon and plus (; , +) that takes the results and saves them in the array of object that called History And created button that logs that in the console you can change it to another interface like innerHTML or alert box you don't must to use the console it's only for the example (as you can see that isn't good idea to use its) hope I helped. https://code.sololearn.com/Wo9Sz4UXNXM3/?ref=app
8th Oct 2018, 7:39 PM
Naty
+ 1
u have to create a array of objects (called history) and update your array with every operation using history.push(last operation => result, calculate, whatever ) And create button that calls to function that shows your array https://code.sololearn.com/WEujGp5o8l36/?ref=app
7th Oct 2018, 9:54 PM
Naty
7th Oct 2018, 11:04 PM
Dante M