Hoisting in JavaScript
Guess what is the output of the program?
1 getName();
2 console.log(x);
3 var x = 7;
4 function getName() {
5 console.log('Namaste JavaScript');
6 }
Output is:
Namaste JavaScript
undefined
Why do we get the above output?
Due to Hoisting.
Now, W...
lovishduggal.hashnode.dev2 min read
Tania Duggal
Good work!