Calculator Complete

Emily Deans
2 min readJul 20, 2017

--

Finally was able to finish and submit the weekly project yesterday. Not exactly the most impressive thing in the world to look at , but I do now have a fully functional basic calculator that I created entirely from scratch based entirely on a static mockup, using HTML, CSS, and JavaScript.

Mockup on the left and my work on the right

I had the majority of the program written by Sunday, but kept getting stuck on the final screen evaluation and return. I tried to create an event listener on the ‘equal’ button that used the ‘eval’ function in JavaScript to return the value of the on-screen operation, but it kept returning a value of NaN (not a number). I realized after much scrutiny and some debugging assistance from one of our assistant instructors that I had a function toward the beginning of my code that was causing the program to capture and attempt to evaluate the full HTML for the screen — thus resulting in the error. Cleared that piece up and now it’s working just swimmingly!

Unfortunately, I can’t share the live/functional version with y’all here because I don’t have it hosted anywhere, but I’ve provided the code below so if you want to create your own files you should be able to get it loaded up in your browser at home!

HTML
CSS
JavaScript

In non-code/bootcamp-related territory, I finished ‘Difficult Women’ by Roxane Gay on my commute today. Amazing. I’ve never read her fiction writing before, and I’ve got to say I love it as much as I love her non-fiction work. Meaning, I love it a lot.

Song of the Day: ‘I Found You’ by Alabama Shakes

--

--

Emily Deans
Emily Deans

Written by Emily Deans

Washington, D.C.-based web developer. Former cheesemaker/food-systems nerd and current nerd in general.