DEV Community

Discussion on: Variables in JavaScript

Collapse
 
sashankr profile image
Sashank Rampalli

Yes let and const are part of es5 and they are used in modern JS code, however, there is still a lot of old code written with var.

I am sharing the basics of variables from Vanilla JS.
Well, const is mainly used to prevent reassigning and overriding its value.
let is used mostly in loops because the counter value has to be reassigned every time.