Home
<!DOCTYPE html> <html> <body> <h1>Demo: JavaScript Variables </h1> <p id="p1"></p> <script> const num = 100; //constant variable document.getElementById("p1").innerHTML = num; num = 200; //error const name; //error: must assign a value name = "Steve"; //error </script> </body> </html>
Result: