Back to Browse

Hoisting in JavaScript and TDZ

3.6K views
May 25, 2021
17:58

In last lecture, we learnt that a variable and a function declaration is stored in Variable object even before the execution of JavaScript code starts. During creation phase, the code is scanned for function declaration and for each function a property is created in variable object assigned with that function definition. Similarly, code is scanned for variable declaration and for each variable, a property is created in variable object and set to undefined if the variable is created using var keyword. Otherwise, if the variable is created using let or const keyword, then it will be set to uninitialized. Because of this, some of the variables and functions are available to use in JavaScript program before it is declared. This is called as hoisting.

Download

1 formats

Video Formats

360pmp419.6 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Hoisting in JavaScript and TDZ | NatokHD