0
function otherfunction (arg){
    console.log(arg);
}
function executeFunction(otherfunction){

}

executeFunction(otherfunction(
    "hello")
    );

This seems redudant , suggestions??

4
Contributors
3
Replies
15
Views
1 Year
Discussion Span
Last Post by diafol
0

In this example, it is redundant. However, in other cases, you can pass another function signature to the executeFunction() function, though that seems excessive unless the function to be called may be dynamically determined due to other things. In any case, do explain what you are trying to accomplish. In the C/C++ and other languages, this is called passing a function pointer to execute in the called function's body, perhaps using variables that the called function has, or knows about, or was passed when called.

0

Just a note: the function 'executeFunction' is not executing anything. In your code, the argument recieved as otherFunction in the executeFunction will be the return of execution of the defined function otherFunction.

0

What exactly are you trying to achieve?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.