+ 3
Calling a function
What is the difference between a function called with the " () braces " and a call with just its name without a braces.
3 Respuestas
+ 5
Functions are treated as objects.
So, like we have an object of a class, functions are also objects. So, if you mention only the name, you are accessing the function object, but if you add (), the function gets called, and it performs its task.
Ex- let sum() be a function to add 2 nums, so
x = sum, then x gets assign that sum object, so we can use x(), and it performs the same thing as sum().
Its simple object operation. I hope u get it.
0
Thanks a bunch