Hoisting means - moving the declaration to the top. There are three types of hoisting:
1. Value hoisting
- Can use the variable in its scope before the line its declared.
- function, function, async function, async function**
2. Declaration hoisting
- Only the declaration is hoisted, means it can be accessed before the declaration line and will not give
ReferenceError, but the value is alwaysUndefined. - var
3. No Hoisting
- OR Technically Hoisted but will give
ReferenceErrorif accessed before its declaration, So it can be simply called No Hoisting - The zone until variable can't be accessed is called the Temporal Dead Zone - TDZ
- let, const, functions expressions