I am looking to be able to create two functions, BaseFunction and CallbackFunction where BaseFunction takes in a variable set of parameters as such:
BaseFunction(arg1, arg2, ....)
{
//Call the Callback function here
}
and callback function receives the same parameters back:
CallbackFunction(value, arg1, arg2, ...)
{
}
How can I pass the parameters from the base function to the callback function?
Use
applyto call a function with an array of parameters.DEMO: http://jsfiddle.net/pYUfG/
For more info on the
argumentsvalue, look at mozilla’s docs.