Hey there!

Iβm bulding a JS calculator and trying to past the FCC test on it. But the FCC test is showing this error:

If 2 or more operators are entered consecutively, the operation performed should be the last operator entered (excluding the negative (-) sign.
The sequence β5 * - 5β = should produce an output of β-25β : expected β-5β to equal β-25β.
Here is my code: https://codepen.io/ulugbek/pen/KOmErL

Interesting enough, the FCC example has the same 13th bug right here: https://codepen.io/freeCodeCamp/full/wgGVVX

Anyone solved this issue? Please share your experiance.

Thanks!

I just solved this problem for someone else! Here, check out this post, it might help:

Guys, Iβm almost through with my JS calc but for one minor problem. Itβs with user story #13 which states:
13. If 2 or more operators are entered consecutively, the operation performed should be the last operator entered (excluding the negative (-) sign.
The sequence β5 * - 5β = should produce an output of β-25β : expected β0β to equal β-25β AssertionError: The sequence β5 * - 5β = should produce an output of β-25β : expected β0β to equal β-25β
(excluding the negative (-) sign was not listed β¦

Also, loosely explain how your code works (mainly the part where the calculation happens [what function are we editing?]).

Hereβs the logic of your code, as I see it working

enter `5`

currentComputation === β`5`

β
enter `*`

currentComputation === β`0`

β
enter `-`

currentComputation === β`0 -`

β
enter `5`

currentComputation === β`0 - 5`

β
And `0 - 5 === -5`

Yes, I think I need to implement some logic to handle negative numbers.