[removed] Passing parameters to a callback function

后端 未结 13 2381
隐瞒了意图╮
隐瞒了意图╮ 2020-11-22 15:48

I\'m trying to pass some parameter to a function used as callback, how can I do that?

function tryMe (param1, param2) {
    alert (param1 + \" and \" + param         


        
13条回答
  •  天涯浪人
    2020-11-22 16:32

    I was looking for the same thing and end up with the solution and here it's a simple example if anybody wants to go through this.

    var FA = function(data){
       console.log("IN A:"+data)
       FC(data,"LastName");
    };
    var FC = function(data,d2){
       console.log("IN C:"+data,d2)
    };
    var FB = function(data){
       console.log("IN B:"+data);
        FA(data)
    };
    FB('FirstName')
    

    Also posted on the other question here

提交回复
热议问题