How To Call Two Function One After Another In Javascript

In Javascript, it is possible to call two functions one after another in a simple and straightforward manner.

Oftentimes, it is necessary to execute multiple functions in sequence to obtain the desired results. This tutorial will guide you through the steps you need to take in order to call two functions one after another in Javascript.


Step 1 – Define the two functions

Before we can call the functions, we must define them. To define a function, you must provide a name for it, and then specify the code that the function will run. For example:

Step 2 – Call the first function

To call the first function, simply use the name of the function followed by parentheses, like this:

Step 3 – Call the second function

To call the second function, use the same technique as in Step 2:

Step 4 – Call the functions in sequence

To call the functions in sequence, you need to call them one after another, like this:

Make sure to call the functions in the order that you want them to be executed. In this example, functionName1() will be executed first, followed by functionName2().

Step 5 – Testing

To test whether the functions are being called correctly, you can add some console.log statements to the functions, like this:

The console.log statements will print messages to the browser console, allowing you to verify that the functions are being called in the correct sequence.


In conclusion, calling two functions one after another in Javascript is a simple process. All you need to do is define the functions and then call them in the desired sequence. By following the steps outlined in this tutorial, you should now have a better understanding of how to call two functions one after another in Javascript.

Full code:


Function 1 is being called.
Function 2 is being called.