Invocation

Running a function, in Javascript, by using parenthesis();

function b() {
}

function a(){
    b(); 
}

a(); 

//So what is really happening? 
- The Global Execution Context (Created and code is executed) 
- Will attach those function (a and b) to the window object
- When it hits a(), it creates a new execution context, called the 'execution stack'
- Anytime you execute a function, a new 'execution context' is created and put on the 'execution stack' 
- So the 'execution context' is created like the global one, so it will have its own space for variable and functions
- However if we have another function invocation and create a new Execution Context.

Every time a function is invoked, a new execution context is created, put on top of the stack and when it finishes, it gets popped off.

Its run line by line, synchronously.

results matching ""

    No results matching ""