+ 2
What is call function ?
2 Respuestas
+ 2
Are you asking about function calling if yes then suppose are working on a project so the code which u have already written for any task and in program u again want to use without overriding so u can use functions. Using function u can divide your tasks in different different modules. And u can use them by calling .
Suppose if u want to do addition of two number
I made a function which name is sum
int sum(int ,int ); this is decleration of function
int sum(int a,int b)
// this is definition of function
{
return a+b;
}
Your main function
{
sum(4,8); // this is called function calling when u want to add two number u can call by using function name () after that semicolon
}
- 1
as you didn't provide any target language, if you are asking about Function.prototype.call method (available for all functions), it allow you to call a function by providing 'this' object as first argument, followed by expected arguments of the target function...
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call
similary, you can use 'apply' method (wich takes an argument array instead of each arguments comma separated), or even 'bind' wich return a new function that you can call with the arguments not provided:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind