The question is not well stated. I would interpret in a longer-winded way as follows. Callbacks are usually named functions. So you would usually have somethig like:
function buttonClicked((){
}
// somewhere else
let callback = buttonClicked;
createButton(......, callback);
or
createButton(......, this.buttonClicked);
I think the idea here might be to use function scope to create unnamed callback functions dynamically. So for example:
function create ButtonCallbacks(action){
if(action == "do this"){
.....
return function(event){
.......
}
} else if (action == "do that"){
....
return function(event){
.....
}
......
}
and then
createButton(....., createButtonCallbacks("do this") )
These âcallbacksâ would then get the values of their parameters from the scope in which they are called, or else from their argument lists. Every time the button is clicked, the callback would do the same thing. Frankly, I think this would be wonderfully confusing in any but the simplest cases, but having all these named callbacks is no picnic either for someone trying to support the code. So âŚ
Steve