Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do brackets surrounding function name mean?

I am looking at someone else's code and trying to understand it. They have a function call name surrounded in parenthesis:

myButton.onclick = (myFunction)(a, b, c); 

Is this different than:

myButton.onclick = myFunction(a, b, c);

edit:

Just to add more context, the function myFunction has the following form:

myFunction = function(a, b, c) {
    return function () {
        // do something with a, b, and c
    }
}
like image 292
Jim Avatar asked Jul 23 '13 17:07

Jim


People also ask

What does function with brackets mean?

Basically this lets you declare an anonymous function, and then by enclosing it in parentheses and writing (someWord) you are running the function. You could think of it as declaring an object and then immediately instantiating the object.

Which type of bracket is placed after name of function?

Parentheses are used after a word to show it is a function.

What are placed inside parentheses after the function name?

Answer: The brackets are placed inside parenthesis after the function name main.

Which brackets are used to give function arguments?

The parentheses are used for passing arguments into a function.


1 Answers

There is no difference.

They do and mean the same thing.

like image 59
Naftali Avatar answered Oct 13 '22 09:10

Naftali