Let's go over a slightly more complex example, our second example. As shown in the following code, we start off by defining an add function. The add function takes arguments a and b, adds them together storing that in a variable called total, and returns total. Next, we add up 3 and 8, which is 11, storing it in the res variable. Then, we print out the response using the console.log statement, as shown here:
var add = (a, b) => {
var total = a + b;
return total;
};
var res = add(3, 8);
console.log(res);
That's it, nothing synchronous is happening. Once again we just need the Call Stack. The first thing that happens is we execute the main function; this starts the program we have here:

Then we run the first statement where we define the add variable. We're not actually executing the function, we're simply defining it here:

In the preceding image, the add() variable gets added on to the Call Stack, and we define add. The next line, line 7, is where we call the add variable storing the return value on the response variable:

In this example, we'll call a function. So we're going to add add() on to the Call Stack, and we'll start executing that function:

As we know, when we add main we start executing main and, when we add add() we start executing add. The first line inside add sets the total variable equal to a + b, which would be 11. We then return from the function using the return total statement. That's the next statement, and when this runs, add gets removed:

So when return total finishes, add() gets removed, then we move on to the final line in the program, our console.log statement, where we print 11 to the screen:

The console.log statement will run, print 11 to the screen and finish the execution, and now we're at the end of the main function, which gets removed from the stack when we implicitly return. This is the second example of a program running through the V8 Call Stack.