I want to do something like this:
function delegate(func, params) {
func(params);
}
function foo(a, b) {
// do stuff
}
function bar(x, y, z) {
// do stuff
}
delegate(foo, 1, 2);
delegate(bar, 1, 2, 3);
I know delegate() will not do what I want as written. How can I write a delegate() that would work for the above examples?
arguments.