3 themed calculator

Solution retrospective
Could use some help please.
Created the 3 themed calculator utilizing flex grid to practice. I used custom colors to practice originality and customization. The themes are toggle using javascript.
I'm posting the incomplete javascript functionality in hopes I can get some pointers. Here's my issue:
I cannot for the life of me figure out how to store the calculator's input data to then be used in the calculation. For example, I will create onclick event handlers for the buttons, but the event handler function cannot return outside of the event handler so I can't store it in an array or variable or whatever i'm trying to store it in. If I can't store it outside the button's functionality, how the heck do I calculate? Maybe there's a perspective i'm not seeing.
So I tried manipulating the span and storing the input into the span, but when I click another event handler it overrides it. Maybe this isn't the right approach. I'm honestly stuck. I watch tutorials but they all approach it in different ways and I'm just trying to do it my own way without just copy pasting their code.
I'm so close to giving up on this calculator. Maybe I wasn't ready for it.
Please log in to post a comment
Log in with GitHubCommunity feedback
No feedback yet. Be the first to give feedback on Cesar D.'s solution.
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord