function main (cb) {
  console.log(cb());
}

main(function () { return "After I get passed to the main() function as the only argument, I'm stored in the local 'cb' variable!"});
// LOG: After I get passed to the main() function as the only argument, I'm stored in the local 'cb' variable!

/* 
We passed an anonymous function, function () { return "After I get passed... }, as the lone argument to our invocation of main().

main() stored the passed-in function in the local cb variable and then invoked the callback function.

The invoked callback returned its long string, which was console.log()-ed out in main().

We know that the parameters we define for our outer function are available anywhere inside the function. As a result, we can pass them as arguments to the callback function. For example:
*/

function greet (name, cb) {
  return cb(name);
}

greet('Ada Lovelace', function (name) { return 'Hello there, ' + name; });
// => "Hello there, Ada Lovelace"

function doMath (num1, num2, cb) {
  return cb(num1, num2);
}

doMath(42, 8, function (num1, num2) { return num1 * num2; });
// => 336