So, lets say I have a little program that gives the user an alert that says Hello, that is inside of a function. Everyone says that you should call functions like this:
var thefunct = awesomefunct();
Yet it still works perfectly fine like this:
awesomefunct();
What is the difference between the two, and why couldn't I just use the second one? I know that both methods work but all my programmer friends tell me to use the first one. Why?
If you run
awesomefunct()
You call the function. So when you type:
var thefunct = awesomefunct();
You run the function and assign the result to thefunct variable.
after that just typing
thefunct
Wont call the function. So there is not that much differencebetween the 2 other than that you catch the return value on the first 1.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments