by Shirshendu Bhowmick

How to declare JavaScript variables: a look at let, const, and var

With the old JavaScript we had only one way to declare a variable that is var x = 10. It will create a variable called x and assign a…

With the old JavaScript, we had only one way to declare a variable, and that was with var, like var x = 10. It will create a variable called x and assign a value 10 to it. Now with modern ES6 JavaScript, we have 3 different ways to declare a variable: let, const and var. We will talk about let &…