Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. var a = 10; // global scope
  2. function foo() {
  3. // Declaration of var a will be hoisted to the top of function.
  4. // Something like: var a;
  5.  
  6. console.log(a); // prints undefined
  7.  
  8. // actual intialisation of value 20 only happens here
  9. var a = 20; // local scope
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement