Calculator - Help Passing Tests

My calculator is displaying the correct results but fails the test cases. I have no idea where the expected values for the tests are coming from and am pretty lost as to how to solve this. Here is my codepen.

https://codepen.io/ramenhero/pen/qBReZze

Hello There!
One thing I noticed when looking at your calculator is that you have a container div (of buttons substract add and equals) with id=“subtract”, wich should be only used in the button subtract.:

<div id="subtract" class="col side-inputs">
   <div class="row-subtract button-size">
      <button id="subtract">-</button>
   </div>
   <div id="add" class="row-add button-size-double-height">
      <button id="add">+</button>
   </div>
   <div id="equals" class="row-equals button-size-double-height">
      <button id="equals">=</button>
   </div>
</div>

I think that the test is not clicking the correct button. Also, if you see the tests that your calculator is not passing, they all are trying some subtraction.
Maybe you could try changing that id?

1 Like

Yep, changing that id=“subtract” solved it all. I also noticed I have elements with the same id so I’ll go ahead and fix that also. Thanks a lot!

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