Saturday 10 February 2018

Help with callbacks

Hi everyone, I need some help with some callback stuff. I sort of get callbacks, but they still confuse me sometimes. Here's what I'm trying to do (it's for an assignment and has to be done this way):You have multiple functions that have a callback. You want to create another function that also has a callback that takes the results from the group of functions and logs in to the console. It looks something like this:var function1 = function(cb) { cb('done 1'); } var function2 = function(cb) { cb('done 2'); } var callback = function(text) { console.log(text) } var function_final = function(function_list, callback) { // fill this in } How can I get the results from the first functions and apply a callback on the final function that outputs these results?

Submitted February 10, 2018 at 04:54PM by PCUK

No comments:

Post a Comment