Calculator project: user story 9 fails but all results are correct

Tested the app and the ‘display’ element always shows the correct result.

This is the code: taschenRechner - Replit

And this is the app running: https://taschenRechner.ovilogic.repl.co

I have no idea what I need to fix because 3 + 5 * 6 - 2 / 4 does produce 32.5 and this is what I get in HTML: <p id='display'>32.5</p>
Tried with <div id='display'>32.5</div> and no improvement.

It seems that all the tests pass at first then 9, 12, 13, 14, and 15 all fail, despite correct answers for the expressions in the test bundle.

I had a look at similar topics but none have this problem.

I would be very grateful if someone could have a look.

I have run the tests with the console open

Maybe try to do that and try to see where the NaN comes from

Thanks for having a look Ilenia

NaN is from test 13. It’s goes away if you replace the ‘display’ <div> with a <p> element. But I still get fail.

You still get this warning

image

Ok, I fixed it by changing the result to a string just before sending it to the ‘display’ element. It should be updated on my links too.

But sadly I still get the same failures

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