Hello, Could someone please help to clarify these errors, as I try and finalise the calculator project. I’ve passed 14 out of 16.
The 2 I’m failing on are:
//User Story #9: In any order, I should be able to add, subtract, multiply and divide a chain of numbers of any length, and when I hit =
, the correct result should be shown in the element with the id of display
.//
When I enter this example calculation:
3 + 5 * 6 - 2 / 4 should produce 32.5 or 11.5. However, my answer is -0.5. This seems to be caused by the - operator remaining in display. Whereas, when I press the other operators they show 0 in display.
//User Story #13: If 2 or more operators are entered consecutively, the operation performed should be the last operator entered (excluding the negative (-) sign). For example, if 5 + * 7 =
is entered, the result should be 35
(i.e. 5 * 7); if 5 * - 5 =
is entered, the result should be -25
(i.e. 5 x (-5)).//
When I enter this example calculation:
The sequence “5 * - + 5” = should produce an output of “10” : expected ‘NaN’ to equal ‘10’. However, my answer is NaN. Again, I the - operator is a problem.
Here’s my pen:
https://codepen.io/53/pen/vYEvwZj?editors=1111
Thank you.