Function Execution Context

What we know

  • Function EC's have access to the Global Object (created in the Global Execution Context).
  • Function EC's are similar to the Global Execution Context
  • Function EC's are created when a function is invoked.

Function Execution Context

The `netflixPlayer` function 

creates its own execution context when it is invoked.

function netflixPlayer(videoContent){
  var message = 'You selected ' + videoContent + ' to play';
  
  return message;

}


// FIRST FUNCTION EXECTION CONTEXT
netflixPlayer('Master of None'); 

Function Execution Context

Variable Obj

  • Contains the variables, functions, and other values that are "local" to the function. (inside the functions code block)
  • Not a "tangible" object we can reference
    • It is used by our runtime environment
    • It is not like the Global Object that can be referenced with "this".

Variable Obj

  • Contains the variables, functions, and other values that are "local" to the function. (inside the functions code block)
  • The values in the Variable Object are not available globally.
function netflixPlayer(videoContent){
  var message = 'You selected ' + videoContent + ' to play';
  
  return message;

}


// FIRST FUNCTION EXECTION CONTEXT
netflixPlayer('Master of None'); 
videoContent
arguments obj
message

Function Execution Context

Function Execution Context

By Scott D'Alessandro

Function Execution Context

  • 576