Super Simple Explanation: What is Hoisting in JavaScript?
🧵⬇️
🧵⬇️
In short,
➡️ Other Programming languages -
First Declare, then use.
➡️ JavaScript -
You want to use it first? Okay! Declare later.
➡️ Other Programming languages -
First Declare, then use.
➡️ JavaScript -
You want to use it first? Okay! Declare later.
➡️ In JavaScript, a variable can be used before it has been declared. This is termed as "Hoisting"
Hoisting can also be understood as a behavior of JS where it automatically moves all declarations to the top of the current scope.
Hoisting can also be understood as a behavior of JS where it automatically moves all declarations to the top of the current scope.
➡️ The concept of Hoisting in Javascript is super-important and a bit confusing at the same time.
However, there is no such need to declare later in the name of Hoisting. It is easier to code when you Declare at the top.
However, there is no such need to declare later in the name of Hoisting. It is easier to code when you Declare at the top.
That's a wrap!
If you enjoyed this thread:
1. Follow me @SushrutKM for more of these
2. RT the tweet below to share this thread with your audience
If you enjoyed this thread:
1. Follow me @SushrutKM for more of these
2. RT the tweet below to share this thread with your audience
Loading suggestions...