DEV Community


Discussion on: Higher-order functions in Javascript

johnson76096186 profile image
Johnson Jay

Save a variable, time2p2. Assign as its value the result of invoking the timeFuncRuntime() function with the checkThatTwoPlusTwoEqualsFourAMillionTimes() function.

timeFuncRuntime() takes a function as an argument. The argument for timeFuncRuntime() is a callback function: timeFuncRuntime() has to actually call the callback function to see how long it takes to execute. Pass the checkThatTwoPlusTwoEqualsFourAMillionTimes() function as the argument for the timeFuncRuntime() function. Make sure to pass in the function without invoking it... What next to do?