JavaScript Calculator Improvements

JavaScript Calculator Improvements
0.0 0


Hello all! I am teaching my students JS and working on the Calculator project. I am looking for help improving functionality, such as avoiding multiple ±?*. ect. Any advice would be appreciated. I just started teaching this course for High School this year…without any previous Comp Sci or coding training. I think I am learning enough to teach the kids correctly but I figured I could use some help digging a litter deeper into this project. Thanks!

JS Lesson:

CodePen link:


I would say that you shouldn’t allow them to put multple binary operators and decimals in. For example, entering “+±++***…//./.” I made the same mistake with my first calc.


I think the beta has a great example of the calculator and it forces you to pass certain tests if you use the testing template (

If you can build this version of the calculator and pass the tests, then I think you are in a better position to teach others how to build a good calculator.