SHARE
TWEET

Untitled

a guest Mar 26th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top