Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var a = 10; // global scope
- function foo() {
- // Declaration of var a will be hoisted to the top of function.
- // Something like: var a;
- console.log(a); // prints undefined
- // actual intialisation of value 20 only happens here
- var a = 20; // local scope
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement