When a JavaScript functions call then an execution context is put on top of the execution stack. Below is the structure of a execution context object.
--Function declaration is stored into VO to pointing a function.
Variables are scanned and for all variable a property is created in VO and set to undefined which is called hoisting .
Hoisting means they are available before execution.We will know more about in the next.
They are not stored in the old Variable Object like
let and const
They are not stored in the old Variable Object like var.
let age = 20;
const PI = 3.14;
They go into a separate Lexical Environment.
They exist in the Temporal Dead Zone (TDZ) until execution reaches their declaration.
No comments:
Post a Comment