Finally got around to tackling this calculator project

Finally got around to tackling this calculator project


Hello all,

It’s been awhile since I posted on this forum, but I had some spare time so I decided to knock out the calculator challenge. Feel free to give me a bug test and let me know if something is broken.

I tried to keep my JavaScript code as simple as possible, without so much crap.

JavaScript Calculator CodePen

If you’d like to check out some of my other stuff:
Personal Website

Edit: I have found a few more errors, such as not being able to perform additional operations to a calculated result. Currently working on improving



Hi. Firstly, I found this task difficult and awkward to get right (it took me a month and it still had bugs).
The first test I try is multiple decimal places:
Next test, pressing different operators.
eg 6 - X 9
And one more to try…
10/3 =
Works but the display overflows.

Stick at it!


ha yea you nailed it on the head. I am trying different things to test for multiple decimal points such as:

number.split('.').length < 2 

or regex. 

Haven’t found anything that is consistent enough without eliminating potential wanted calculations from the user. Thanks for the feedback. I just finished updating the results if they go off the screen as well using the

.toString().toExponential() combo


Hey, if you find a method that works, then that’s fine in my opinion. :+1: