// JavaScript "hoists" variables to the top of // their scope. So the following function: function printName() { console.log('Hello, ' + name); var name = 'Bob'; } // is equivalent to this function: function printName() { var name; console.log('Hello, ' + name); name = 'Bob'; } printName(); // Hello, undefined