Building the javascript calculator

I’m following along the UsefulDeveloper account on Youtube and I’m at the part where the calculator should be able to add, subtract, multiply and divide multiple numbers. The calculator does work but the test tells me that it doesn’t. Any hints?


Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Firefox/78.0

Challenge: Build a JavaScript Calculator

Link to the challenge:

We can’t tell you anything without seeing the code. Post it on Codepen so we can see a live example.

My apologies, heres my codepen link.

Try entering the calculation twice in a row with a clear in between.

clearDisplay just does DOM stuff, I don’t see anywhere in the code that you are resetting the state.

Thanks, that was it. I’ve added the trailingResult and the workingOperator to my clear function.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.