0

I have this function,

function foo (foo1, foo2) {
   ...
}

I need to pass it as an argument of another function :

caller(foo);

how is the most proper way to pass the arguments of foo in the caller function ?

vdegenne
  • 12,272
  • 14
  • 80
  • 106

1 Answers1

1

Did you try something like this?

function internalMethod(a, b) {
   console.log(a);
   console.log(b);
}

function externalMethod (method) {
    method (arguments[1], arguments[2]);
}

externalMethod (internalMethod, "First argument", "Second argument");

Hope it help.

Márcio Gonzalez
  • 1,020
  • 1
  • 8
  • 20