Skip to content Skip to sidebar Skip to footer

Getting Undefined For This Callback Function

prepOutput() is a simple function that takes an average and returns the callback output(), but I am getting an undefined error at 'return callback(out)'. Why is the callback not wo

Solution 1:

You need to pass a function reference as the value for callback, instead you are invoking output and is passing the value returned from it(undefined as there is no value returned) as the value for callback argument to prepOutput

prepOutput(avgSpeed(), output);

Problem: Demo - output is called before prepOutput Demo: Fiddle

Post a Comment for "Getting Undefined For This Callback Function"