case 1 →
{
const pqt = “My javascript code”;
document.write(pqt);
}
document.write("
");
pqt = “Hello Javascript”;
document.write(pqt);
output :-> My javascript code
Hello Javascript
Case 2 →
{
var x = 50;
document.write(x);
}
document.write("
");
x = 80;
document.write(x);
output :-> 50
80
Then What is the difference between const and var.
If const did not change after the print then also var also not change after print.
if we change var then we have to print var then same for const.