A simple example of hoisting with function expressions
var sayHello; // currently undefined
sayHello(); // undefined is not a function
sayHello = function() { // only here is the variable assigned
console.log('Hello, world!');
};
sayHello(); // will error out (see below for reason)
var sayHello = function() {
console.log('Hello, world!');
};