Hi all, just finish my react calculator, I made a calculator in the past with eval but I tryed to make this without eval and from the scartch not looking on other examples, please if you can review my code I will be glad.
And also I have a question about the logic requested for the calculator.
The thing is with this operation: 5 * - + 5. That the bundle says should be 10.
But to do that I should remove “*” and “-” when I hit “+”, thats how works the example. But is wise this logic? Shouldn’t remove the negative sign when I hit “+” that was the last sign? All calculators work that way? just asking before refactor that.
In this example when I hit the sum sign it deletes both, subtract and multiply sign, so 5 * - + 5 it becomes in 5 + 5. I don’t know if general calculators work that way. I tested a few that I have and all have different results:
Galculator from manjaro gives 25 (5*5) so takes the first operator that I hit.
On an old LG works just like the example, when I hit plus remove multiply and subtract .
edit: google gives -25.
And in another cellphone I got an error.
I’m trying the understand why and when should I remove which signs to fix my code.