Friday, April 8, 2011

How do you invoke a callback using a predefined method but passing parameters?

function callback(a){

}

function b( ...., callback(data))
{

} 

what is the problem with the above code snippet?

1 comment:

  1. Call back is indirection to the procedure (address), parameters must be passed separately (C/C++). It can be

    function callback(a){

    }

    function b( ...., callback, data)
    {

    }

    The caller (b in the above case) will do the business with 'callback'. What to pass as parameter is upto the caller, it can pass internal value or 'data' as parameter.

    If not correct, let me know if I am missing anything.

    ReplyDelete