Home / Javascript Tips Generated By ChatGPT / Understanding Variable Hoisting in Javascript Variables declared with var are hoisted to the top of their scope. Source Code console.log(x); // undefined, not ReferenceError var x = 5;