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
}
}
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.
Parentheses are used after a word to show it is a function.
Answer: The brackets are placed inside parenthesis after the function name main.
The parentheses are used for passing arguments into a function.
There is no difference.
They do and mean the same thing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With