Calculator failing a bunch of tests but appears to work properly

Calculator failing a bunch of tests but appears to work properly
0.0 0

#1

Hey everyone,
I just got started with my Javascript calculator project, but it appears to be failing a bunch of tests for no reason?

Here’s my pen:

It’s not finished so some of the tests are bound to fail but 7, 8, 9, 11, 12, and I think 14 and 15 should pass.

Thanks in advance!!


#2

The problem is you are using an input element to display your results. Input elements have values, but they do not have text. A div would be a better option here, because the value would be displayed between the <div> and </div> tags. Another reason you do not want to use an input element to display the value, is that the user could accidentally/purposely type over the information in it, which could cause strange problems.

<div id="display">0</div>

#3

Right! Fixed, thanks!!