Skip to main content

JavaScript Certification Study Topic: Understand Hoisting in JavaScript

Understand "Hoisting" in JavaScript is important and at the same time somewhat misleading. In this video, I will cover the Hoisting concept. This is a process that happens while the JavaScript engine interprets the written JavaScript code.

JavaScript engine always interprets the JavaScript code within the Global Execution context which comes with two phases - compilation and execution.

During the compilation phase, JavaScript will parse the written code to find out all functions and variable declarations. When found, it will allocate space in memory for each of the declared variables. This is what knows as "Hoisting".

So "Hoisting" is a process of moving variable and function declarations to the top of the scope. This creates the illusion of "moving at the top of their scope", but in reality, the JavaScript engine will store the declared variables and functions in memory even before the rest of the code try to refer to them.

During the execution phase, the JavaScript engine will assign values to the variables and start processing functions.

Based on the discussion above where I have explained how JavaScript codes are being interpreted, all variable and functions are lifted to the top of their functional/local or global scope regardless of there where they are declared. This is what known as "Hoisting".

 

Blog: https://www.sudipta-deb.in/2021/06/understand-hoisting-in-javascript.html

Video: https://youtu.be/zpR2zT-AlGE

 

Note - I am sharing all my JavaScript Certification study notes below. Please provide your feedback if you see anything wrong or missing. Appreciate your help.

https://www.sudipta-deb.in/p/salesforce-javascript-developer-i-study.html

 

@The Blog Group @Developer Group, Kitchener, CA @Developer Group, Mississauga, CA @* Salesforce Developers * @Developer Group, Dhaka, BD @Admin Group, Mumbai, IN @Admin Group, Chennai, IN @Toronto Administrators Community Group @Admin Group, Jaipur, IN @Admin Group, Dubai, UAE @* Salesforce Administrators * @Admin Group, Bikaner, IN @Certified Javascript Developer I Study G @Platform Champion Alumni @Toronto Salesforce Developer Group @Kolkata User Group @Kolkata User Group, India 

3 条评论
  1. 2022年7月30日 11:41

    JavaScript engine always interprets the JavaScript code within the Global Execution context which comes with two phases compilation and execution Visit the provided URL usclinicalresearch.com for further information Visit this link to discover how to write essays and enhance your writing skills You can choose from a variety of essay topics thanks to it as well.

0/9000