<html>
<body>
<h2>Declaring a Variable Using const</h2>
<p id="demo"></p>
<script>
var x = 10;
// Here x is 10
{
const x = 2;
// Here x is 2
}
// Here x is 10
document.getElementById("demo").innerHTML = x;
</script>
</body>
<!-- /js/tryit.asp?filename=tryjs_es6_const Thu, 06 Feb 2025 19:15:30 GMT -->
</html>