The Iron Yard — Day 14, 15 & 16 (Calculator App, Remote Requests, Promises & Fetch)

I missed the past couple of blogs because I have been super focused on the weekly project, which was to build a functional calculator application using html, css and basic JavaScript. I ended up using something which turns out to not be good practice, which is eval(). It was said that eval() is a massive security hole that allows not so nice people to reprogram your program, not good. Oh, and apparently the point of the assignment was to do the calculations on your own, and not use a nice but security compromising function to do it for you, oops.

I rewrote the calculator app JavaScript to do the calculations manually. One of the hard mode of the assignments was to make the calculator do complex calculations involving order of operations. This was hard. I took an unorthodox approach and created an array of numbers and operators, then used a series of if-else statements with indexOf() to perform the operations in order of precedence. You can see the finished product here: https://github.com/jakelafond/calculator

Today’s focus is all about remote requests, promises/callbacks and using the fetch library to get data. The act of retrieving data from an external source and manipulating that data is pretty amazing to me, I feel like I am doing magic (the kind where you draw from some source then manipulate that source to do what you want).

Basically, in learning to be a full stack developer I am learning to be a magician.

Tomorrow’s focus — Creating and Storing Cookies & Cross-Origin Resource Sharing

Eval() can circumvent all of your security.