Variables

Variables are created inside every Execution context for data allocation in the memory.

  • Every execution context will be created with this, argument object along with variable environment.

  • variable is used to store any data that to be used in the program.

  • variables are assigned to the memory when the execution context is created.

  • when the execution context is destroyed(after function invocation is completed), the variable space will be removed from the memory.

function two() {
    var name; // undefined
}

function one() {
    var name = "Vijay"; // "Vijay"
}

var name = "Deepak"; // "Deepak"

Every Variable environment inside the Execution context has its own variables.

Last updated