Differnce between var and const

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.

Hi.
I request you to check your output one more time on console.
in case 1 output is : Assignment to constant variable.
You can’t reassign the value to const.
In case of var, it never matters how many times you are re - assigning as well as redeclaring.
Thanks.