I have a pre-process function, here's an example function
function preprocess (msg, fct) {
alert(msg);
fct(???);
}
I need to execute the function fct
in the preprocess
function, but fct
not always has the same number of parameters. I am not a pro in javascript but I think there are 2 ways to achieve that :
explicit call with an object
function preprocess (msg, fct, obj) { ... }
usage : preprocess ('hello', myfct, {firstparam: 'foo', secondparam: 'bar'});
- using the argument inner property of the function
anyways i might have the theory, i am not able to code both the case above. Is it possible to achieve what I need using both the ways ? if yes, could you provide a minimum example of each to show me the way ?