Hoisting in JavaScript
Before we dive into what Hoisting is let us go through an example and understand this phenomenon.
INPUT -->
getName();
console.log(x);
var x = 7;
function getName(){
console.log("Siddhartha Sahu Blog");
}
OUTPUT -->
Siddhartha Sahu Blog
undefined
...
siddharthasahu.hashnode.dev3 min read
Vidhu Gupta
This is very interesting. You have explained it with great clarity.