Javascript Calculator review for bugs

Hi, I’ve completed a simple JS calculator. I fixed most of number format bugs, but I’m pretty sure there are more bugs I haven’t able to find. Please check my work and help me find bugs. FYI, the calculator’s design looks horrible, just like most of my other projects.

JS Calculator

I think one of the user stories was to be able to chain operators, for example, ‘8*8+9-2/1’, but when I used your calculator it only evaluated my latest operator.

I believe the way I did it is that you have to hit the equal key in order to proceed to the next operation, but the result of the previous calculation is still being kept unless you hit AC key, but I guess it is not very user-friendly that way. Thank for pointing that out, I will modify it.

Also take a look at the result of 100x9%=

Yeah, I guess it is a bug from the fact that I only let the calculation happen when user hit equal key. I guess it is better to calculate result when user hit any operator key, I’ll modify that

I kinda fixed the issue that you pointed out. It is kinda a temporary fix, for now. The code looks way too messy that I guess I’m going to rewrite it in a different way.

1 Like

I was sure you will end up deciding that a code refactoring its easier then debugging it.

“A patch is a piece of software which replaces old bugs with new bugs.”