Front End Development Libraries Projects - Build a JavaScript Calculator. Tests should pass but they don't

Tell us what’s happening:
So i’m testing my calculator with the testing tool, but 4 of the tests don’t pass, even though i clearly get the needed result when performing the test myself. What should I do about this?

Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36 OPR/96.0.0.0

Challenge: Front End Development Libraries Projects - Build a JavaScript Calculator

Link to the challenge:

try input:

3
+
5
*

I would expect to see 8 in the display after that, but I see 15.

1 Like

Hmm damnit, i swear this worked fine before :rofl: I must’ve messed something up, thanks i’ll have to fix it

Ok I’ve fixed it, I can now get 11.5 as a result after inputting 3 + 5 x 6 - 2 / 4 =, but the test is still invalid

I can’t see issues in regards to this test directly rn.
But there is definitely weird stuff is going on with floats:
11.3 - 6.3 =
5.000000000000001

Maybe something is off because of how you handling rounding?

1 Like

Most of your tests are failing because of some ‘new line’ thing creeping into your results:

The sequence “5 * - 5” = should produce an output of “-25” : expected ‘5 x -5 =\n-25’ to equal ‘-25’

1 Like

Oh i see, interesting. Any idea where is it coming from? I don’t use \n at any point in my code. Don’t know how to get rid of it

I haven’t actually implemented the rounding yet

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