Calculator - User story 8

Tell us what’s happening:

I’ve got it so that my numbers are appearing in the display (calculator style) but it’s still not passing the user story.

It says it’s expecting ‘0’ to equal ‘123’?

I’m not quite getting where I’m going wrong.

Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36.

Challenge: Build a JavaScript Calculator

Link to the challenge:

11. When the decimal element is clicked, a “.” should append to the currently displayed value; two “.” in one number should not be accepted

and then you miss all the point from 13 through 15

Thanks :slight_smile: I’ve not gotten to that bit yet.

I’m still struggling on section 8.

I’ve added the decimal point in and it’s still not passing that story or 8.

Does it need to accept keyboard input for section 8 to pass? Atm it only works when the buttons are clicked.

I’ve added some basic functionality for it to accept key presses for the numbers (1,2,3) and still nothing!

I’ve found that if I just take the responsive part of the display out and type “123” in it then it passes but for some reason it isn’t passing when it’s taking the value from state :confused:

I’m going to try giving this a bump, really struggling to figure this one out.

Solved:

The ID needed to be on the button element not the containing DIV element