0

I'm working with a JavaScript library, and it takes callbacks as a parameter to functions, that execute when the function is completed. So, for instance, I have something like:

bot.dig(target, callBackFunc)

and callbackFunc is something like:

function callBackFunc(err) {
   console.log("hi");
   return 0;
}

and this is fine.

However, I would like to be able to actually pass parameters into this callBackFunc, something like:

bot.dig(target, callBackFunc("hello!"))

function callBackFunc(err, input) {
   console.log(input);
   return 0;
}

but this does not work/throws a bunch of errors. How can I accomplish passing a parameter into this callback function?

Thank you!

Evan
  • 1,892
  • 2
  • 19
  • 40

0 Answers0