What is a hoisted ?
Hoisted is the declaration of variables and function are move the top of the global scope in during the runtime.
The hoisted is help the program the code was executes the function call before.
myFunction(); // Output: Hello from myFunction!
function myFunction() {
console.log("Hello from myFunction!");
}
What is a not hoisted ?
The Not hoisted is the code executed top of the block is not initialized.
Then access the code in before is declaration function result is Error
console.log(a); // ❌ ReferenceError
let a = 5;
Top comments (0)