A while back, I went to New York City to a free coding class at the Hack Reactor Bootcamp. Occasionally, they offer free one night classes on various topics. This one was the higher-order-functions workshop and after some lecture and the expected (and appropriate) marketing of apply-to-hack-reactor, we all downloaded a git repo with an assignment and some tests that we had to have our code pass. The basic idea was to write your own array methods including forEach, filter, map, and reduce. The idea was to get one to gain a fuller understanding of what was going on ‘under the hood’ when calling these methods.
As for myself, I managed to get through forEach but was stumped on how to actually use it to complete the next few methods, which was a requirement of the rest of the assignment. I’ve spent quite a bit of time on these and really think I have a much better understanding of how they work. So my few posts will be an attempt to explain not only how to code each of these methods but hopefully give you a deeper understanding of what is going on behind the curtain.
I have since seen this same basic assignment in several different places online such as a free mini-boot camp from Lambda School, online tutorials, etc. so it’s not unique to Hack Reactor but here is the Hack Reactor higher-order functions workshop git repo. I’m assuming they don’t mind this being shared since it is after all in a public repo, but I will add that if I could afford it I would love to go to Hack Reactor and you should definitely apply! 🙂
I’ll put my solution code and explanation in a separate post.