Home
<!DOCTYPE html> <html> <body> <h1>Demo: JavaScript Variables </h1> <p id="p1"></p> <p id="p2"></p> <p id="p3"></p> <script> let myvariable = 1; // numeric value document.getElementById("p1").textContent = myvariable; myvariable = 'one'; // string value document.getElementById("p2").textContent = myvariable; myvariable = true; // Boolean value document.getElementById("p3").textContent = myvariable; </script> </body> </html>
Result: