Scimonster

Hoisting example

Sep 29th, 2014
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. myFunction();
  2. function myFunction() {alert('this is defined after its called, but is hoisted because of the function keyword')}
  3.  
  4. myFunction();
  5. var myFunction = function() {alert('this will fail, because it is not defined when it is called')}
Advertisement
Add Comment
Please, Sign In to add comment