Skip to content
Latest: The updated version of the Creating NPM Package (React JavaScript) book is out

Invoke vs Call a Function – Learn the Difference

“Function invocation” invokes a value from a function, while “function calling” calls for the function. Let’s discuss these differences.

What Does “Invoke a Function” Mean in Programming?

“Invoke a function” means executing a function to retrieve its value. We use the function’s name and an invocator (()) to invoke a function.

Here’s the syntax:

functionName();

Below are examples of how to invoke a function.

How to invoke a function without an argument

// Define a function:
function multiplyNumbers() {
return 3 * 100;
}
// Invoke the multiplyNumbers function:
multiplyNumbers();
// The invocation above will return: 300

The snippet above invoked the multiplyNumbers function without passing any argument to its parameters.

How to invoke a function with two arguments

// Define a function:
function multiplyNumbers(a, b) {
return a * b;
}
// Invoke the multiplyNumbers function:
multiplyNumbers(3, 100);
// The invocation above will return: 300

The snippet above invoked the multiplyNumbers function while passing two arguments (3 and 100) to its parameters (a and b).

What Does “Call a Function” Mean in Programming?

“Calling a function” means to call for a function without retrieving its value. We use the function’s name only to call a function.

Here’s the syntax:

functionName;

Here’s an example:

// Define a function:
function multiplyNumbers(a, b) {
return a * b;
}
// Call the multiplyNumbers function:
multiplyNumbers;
// The call above will return:
ƒ multiplyNumbers(a, b) {
return a * b;
}

The snippet above used the function’s name (multiplyNumbers) to call the function without retrieving its value.