What is call stack?
Consider the following image for the sake of understanding.
Here, first of all JS is designed to be run on the main() thread and so the main() function will be called first when we execute the above code all together. The entry execution point is console.log() statement and the execution will be halted until the argument provided inside does not finish its execution i.e. bar(6). Now, the bar(6) will be pushed on to the stack and then it calls the function foo(3*6) and hence comes on top. Now, when the execution of foo() finishes, it will return the result by popping the entry from stack and comes down to bar(6) which in turn will return entry to the console and it prints the result.