React Calculator issue with "-" | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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 Respostas
+ 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