DEV Community

Cover image for Difference between var, let and const, in Javascript.
Abhishek Maurya
Abhishek Maurya

Posted on

Difference between var, let and const, in Javascript.

var is global scope,
let is block scope,
const is also block scope.

But we can change the value of let variable within its block scope as many times as we want.

And we can never be able to change the value of const variable again after it is initilized in its scope.

In other words:

We can mutate the let variabe value any number of times,
But const is constant forever.

I Hope you understand this well, Thanks.
The End.

Top comments (0)