njdennis94

hoisting blog post 5

Aug 8th, 2018
178
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function variableDifferences(){
  2.    for(var x = 0; x < 3; x++){ }
  3.    
  4.    for(let y = 0; y < 3; y++){ } // ReferenceError: y is not defined
  5.    
  6.    console.log(x) // x is 3.
  7. }
  8. test()
RAW Paste Data