Home
<!DOCTYPE html> <html> <body> <h1>Demo: Hoisting</h1> <p id="p1">x = </p> <script> x = 1; document.getElementById("p1").innerHTML = x ; var x; </script> </body> </html>
Result: