Understanding hoisting in JavaScript