JavaScript Hoisting.
Complete Explanation:
Thread 🧵
Complete Explanation:
Thread 🧵
Before Starting the concept of Hoisting , you have to understand the flow of “ How JavaScript Works “ .
Hoisting is JavaScript's default behavior of moving declarations to the top.
In JavaScript, a variable can be declared after it has been used.
Hoisting is JavaScript's default behavior of moving declarations to the top.
In JavaScript, a variable can be declared after it has been used.
that is the concept of Hoisting because the JavaScript Interpreter will move all declarations to the top of the current scope. ( It means they pull the defination of the function at the top )
Let's examine the same hoisting concept in a variable.
Let's examine the same hoisting concept in a variable.
Using a "let" variable before it is declared will result in a "ReferenceError".
The variable is in a "temporal dead zone" from the start of the block until it is declared:
The variable is in a "temporal dead zone" from the start of the block until it is declared:
If you enjoyed reading this thread, please do the following:
1. Like the thread❤️
2. Retweet the first tweet.🔃
3. Follow me and enable notifications: ✅
@CodeMarch
Thank you for reading all the way through.
1. Like the thread❤️
2. Retweet the first tweet.🔃
3. Follow me and enable notifications: ✅
@CodeMarch
Thank you for reading all the way through.
Download our free JavaScript Resources ebook Here:
codemarch.gumroad.com
codemarch.gumroad.com
Loading suggestions...