A function can be assigned to a variable, passed to a function, or returned from a function, just like any other values.

For example, the following code defines a function, a() and then assigns it to the variable b. Notice that the parentheses operator, (), is omitted; if it were included, the code would simply assign a()’s return value to b.

function a(){

var b=a;

Once a function has been assigned to a variable, it can be invoked through that variable using the standard parentheses operator, (). For example, the following code invokes the function a() through the variable b:


Spread the love