React Calculator issue with "-" | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

React Calculator issue with "-"

So i have this calculator, for the freecodecamp exercice. Everything works except one test case. When i press more than 1 operator consecutively, the operation performed should be the last one entered, except for -. That exception messes up my test case. I have no idea how to fix it. Help I attempted something with a "negative" variable, but I had no success. https://codepen.io/AlexTAG/pen/YzgdGoX?editors=0011

15th Feb 2024, 11:46 AM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar
2 Answers
+ 1
Could you create an if else which checks the -(minus) operation
15th Feb 2024, 3:32 PM
Ausgrindtube
Ausgrindtube - avatar
0
I can, but the issue is, what do i actually check ?
15th Feb 2024, 5:10 PM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar