Decimal button not working on my calculator project


#1

I cannot get the decimal button to work in my calculator.

I’ve tried to have a var that when switched to on stops the decimal button from working. Unfortunately when clicking the decimal button two decimals are appearing and the decimal is not being dissabled. I think something is wrong with my if else statement.

CODE pen is here: https://codepen.io/Steve91/pen/RqKXyZ


#2

I take it you’ve fixed this problem, as the decimal doesn’t behave the way you describe and seems fine.

Good work!

By the way, the behavior is not as I would expect after getting a result. I would expect to be able to begin a new calculation without pressing ‘clr’ first.

Also, I would expect ‘8’, followed by ‘=’ (for example) to display ‘8’ not ‘0’.

Minor points, and your calculator basically works, so you may prefer to move on rather than address these issues.