#Lessons From A JavaScript Code Review
I was recently asked to review some code and thought I might share some of the feedback I provided as it includes a mention of JavaScript fundamentals that are always useful to bear in mind.
####Problem: Functions to be used as callbacks (as well as objects) are passed as parameters to other functions without any type validation.
Feedback: For functions, at minimum 1) test to ensure the callback exists and 2) do a typeof check to avoid issues with the app attempting to execute input which may not in fact be a valid function at all.
if (callback && typeof(callback) === "function"){