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 var x = 5;