[Solved] Calculator jquery [closed]


You should do

html =  parseInt(this.prevEq) + parseInt(html);

and

html =  parseInt(this.prevEq) - parseInt(html);

Instead of

html =  parseInt(html) + parseInt(this.prevEq);

and

html =  parseInt(html) - parseInt(this.prevEq);

The order is not a problem when you’re adding. It is when you’re subtracting. (a + b) == (b + a) but (a - b) != (b - a)

EDIT

Oops, this doesn’t seem the problem you wanted to resolve. I just looked in your code and solved the first bug I saw.
You will need to add an ‘=’ button to show the result and clear the stack I guess. I’m not really sure what you intend to do here. To me it seems perfectly acceptable to keep adding and subtracting numbers.

EDIT 2

I started over and came with a new solution

7

solved Calculator jquery [closed]