[Solved] Get function result instead of it body [closed]


Instead calc of following line

$('#button').click(function(){alert(calc);})

Use calc() as shown below

 $('#button').click(function(){alert(calc());})

The difference between calc and calc() is

When you write calc that time you are passing the function as a Parameter instead of it’s return value. This is useful when you are passing a function as a Callback to execute it later.

But When you write calc() that time you are executing means calling function.

solved Get function result instead of it body [closed]