The purpose of this challenge was to create a callback function. A callback function uses another function as a parameter. In my code, I used a function to determine my favorite drink based on the daily temperature. Then, I passed that function into another function as a parameter that identified if my favorite drink was an option in an array of drink options. Lastly, it printed my drink order for me based on if my drink was available or not.
The most challenging part was figuring out how my function would determine what my drink choice was. I also needed to find a way to identify if my favorite drink was available. For this, I used the .includes method.
I spend a long time on this challenge, but it helped me better understand how callback functions work. In my second callback function, I used setInterval and passed an anonymous function. This was much simpler and quicker to write. Next time, I write a callback function, I hope to be able to do it in much less time.