iOS Javascript Calculator

In my spare time I’ve been plugging away at the Front-end projects for FreeCodeCamp. The first Advanced Front-end Developer project was to build a Javascript calculator. I chose to make mine look like the iPhone calculator since I had it with me and could use it for the design and functionality. When I needed to test how the calculator should work I was able to try it out and see what happened first.

An example would be after you have completed an equation and use the = button. If you click another operator you continue the equation starting with the answer from the previous one. If instead you click a number than you are starting a new calculation. To account for this I had to add some extra tests in the addValue function.

The Javascript Calculator

See the Pen iOS Calculator by Anthony Skelton (@ajskelton) on CodePen.

It was a great exercise and I’m really happy with how my javascript calculator turned out. Next up is creating a Pomodoro clock.

Leave a Reply