Higher Order Functions in JS

Now this is nothing new and fresh but for me it really was an ah ha moment when you are building out an application there are times when having a pre set function that is going to do some work later on. Now I am familiar with objects, methods, ect but sometimes a function within a function just feels right.

Lets Make Sandwiches With JavaScript

In this example let’s say we are making 3 different types of sandwiches, but depending on the type of sandwich there is going to be a different cost associated.

Sandwich types:

Dutch Munch, Tater Island, and Sweet Georgia

Each of these are going to have an automatic calculation associate with them due to the ingredients.

Dutch munch = toppings + 2

Tater Island = toppings * 3

Sweet Georgia = topping – 1

Bread cost = 1$ per slice

How Can A Function Help

Knowing that the cost of toppings plus the type of sandwich up charge how can we do this?

Let’s say that we need to have each topping cost $1 and each piece of bread used is also $1, but then each type of sandwich due to the cost of meat, special ect has certain costs associated. So first we know we are going to have a sandwich function which will always have the toppings and sandwich types, and each type of sandwich is going to have its own function.

Const toppingTotal = 1;

Cost bread =1;

Function dutchMunch(toppingTotal, bread){
Return (toppingTotal + bread) + 2


Function taterIsland(toppingTotal, bread){
Return (toppingTotal + bread) * 3


Function sweetGeorgia(toppingTotal, bread){
Return (toppingTotal + bread) -1


Function sandwich(toppingTotal,bread,sandType){
Return sandType(toppingtoal, bread);


Higher Order Function What!

So what is a Higher Order Function… basically, just a function that can take other functions as inputs. This helps in this situation as when we are creating the orders the input can be as follows.


Behind the scenes this is automatically providing the (toppingTotal + bread) -1 that is allocated when someone buys a Sweet Georgia sandwich as it is the sandwich of the day. So save a buck and write a higher order function.


What we did here is the beauty of JS and that is using a higher order function that is taking inputs from other functions to get the job done!

All Things Open Raleigh NC 2018

This was my first conference and it was amazing in so many ways. I am going to give a quick breakdown of some of the highlights for me and what my takeaways were in term of learning and experience. I cannot recommend a conference enough after I have gone, but with that said 3 a year every year is not needed. The biggest take away is although people are speaking and giving presentations on the technology you are interested in we are all human and can achieve what we want.

Before the Event Pre Game

I received my email saying what to bring and the schedule the day before, and as I was out of town there was no early registration for picking up my badge and swag…..oh that swag how I love it so much. So I knew that to be prepared I needed to be there early (7AM) and with a no brain fog. I went ahead and looked at the scheduled talks and mapped out my day, then crashed out for the night. I felt this was a good plan of action and also having it mapped out ahead of time gave me an insight on what to expect.

Day 1 of ATO

Showing up at the crack of dawn to go to an all day conference may of not been the best idea but in the end it was. All the booths were just getting set up and no one was there which means all the swag I want was at my fingertips, but also information on all the vendors. It is really neat to see the technology being showcased and seeing how it works, but when the event is in full swing that can be hard to do. After a bunch of cool shirts, socks, stickers, and free magazines I had the schedule of the day and started highlighting my plan.

First talk went amazing learning about functional programming in JavaScript and then I sat in for a start-up contest on new technologies which was super cool including BruVue, TriggerMesh and more. Those two stuck out the most check them out. In the afternoon I went to a Node.js crash course, CSS Bloat and How to Fix it, and wrapping up the day with Jen Looper titled human vs. ai: build a mobile app with vue.js, ml kit, and nativescript. By this time my brain was fried and it was time to go home.

Day 2 of ATO

Showed up early but not as early as the day before, as most of the swag was already spoken for and I had some solid goals for learning. The tracks for day 2 were cross-platform desktop apps with electron JS, framework free – building a single page application without a js framework (not needed but neat to see why frameworks are nice),  and rapid prototyping with vue.js . I have to say that fully impressed with all the learning opportunities and it truly did give me a revamp of wanting to code more.


This was truly an awesome experience and one that I hope to attend next year. My takeaways as I said is that we are all human and with consistent learning and positive attitude a good programmer can become better. I have to thank all those people for putting on this event and also the people who took the time to actually speak and put presentations together. There was one presenter that really took the cake and that was David Neil at https://reverentgeek.com/ really did great talks but also had some solid humor to go with it as well.

Learning JavaScript is Cool But Accessing Your Values is Better

Seems like always going back to the basics is key to growing in your journey as a developer. I find that if I am not consistently doing projects using all the tools then I forget. In my current situation there is not many peers to jump ideas off ect, so sometimes going to a beginner course for Javascript as the one offered in FreeCodeCamp helps tremendously. My “ah ha” moment came when I was almost done with basics of JS section and started with objects and how to access them. Writing code is great but it really comes down to (write code, compute, access values, and display).

Creating the Object in Javascript

There was a magical thing that happened with OOP was thought of and till this day I think it is a powerful concept. Create objects let them have duties, hold data ect, and then pull from them for your desired outcome.

An object could look like this:

How to access the object

You have a couple choices in this case I am going to go with dot notation “.” and also bracket []. I personally have no preference but the neat part is some of the differences.


  1. Property identifies can only be alphanumeric (and _ and $)
  2. Identifier cannot start with a number
  3. Identifier cannot be a variable


  1. Identifier has to be a string or variable representing a string
  2. You can use variables, strings, spaces, and numbers for your identifier

Fun fact with both of these if you flatten your object and it is returned in dot notation you can then call on multiple objects using the bracket notation.


I literally wanted to jot this down as when you are making amazing code which is great the bigger it grows naturally you have to place objects together that hold data and so much more, so knowing some options from a beginner level on how to access them is key. As always I write this for myself but if anyone ever gets a little help from it then that is even better.