Skip to main content
Rakuten Kobo US

Invoke vs Call a Function – Learn the Difference

"Invoke a function" and "Call a function" are popular programming terms. But what exactly do they mean? Let's find out.

What Does "Invoke a Function" Mean in Programming?

"Invoke a function" means executing a function to retrieve its value.

How to invoke a function

We use the function's name and an invocator (()) to invoke a function.

Here's the syntax:

functionName();

Examples

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.

React Explained Clearly Book Now Available at Amazon

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.

How to call a function

We use the function's name only to call a function.

Here's the syntax:

functionName;

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.

Overview

"Function invocation" invokes a value from a function. But "function calling" calls for the function.