Javscript passing and using that function

Posted by Totty on Stack Overflow See other posts from Stack Overflow or by Totty
Published on 2010-04-27T14:56:06Z Indexed on 2010/04/27 15:03 UTC
Read the original article Hit count: 146

Filed under:

I have:

var f1 = function(a){
    alert(a)
}

var f2 = function(data, method){
    method(data) // the problem is here, 
    // the method f1 is not called. Is there a way to call that method f1?
    // the method f1 might not be in this scope, the method f1 can 
    // be in a class or like this... 
}

f2(a, f1)

The question is: Is there a way to call that f1 from f2, from the passed method? thanks

© Stack Overflow or respective owner

Related posts about JavaScript