Can someone please explain to me the concept of continuation passing in javascript? I'm trying to understand it by reading this http://nathansjslessons.appspot.com/lesson?id=1090 and trying to solve the exercise given, but I can't seem to solve it.
What would be the correct way of doing it?
I tried this:
var bothC = function (fC, gC, success, failure) {
var f_success, f_failure;
f_success = function () {
success();
};
f_failure = function () {
var g_success, g_failure;
g_success = function () {
success();
};
g_failure = function () {
failure();
};
gC(g_success, g_failure);
};
fC(f_success, f_failure);
};