Variable Declarations with let and const

Learn about the behavior of "var", "let", and "const" and the differences between them.

For many years, we could only use var to declare a variable in JavaScript. Since 2015 however, JavaScript has gained two new keywords that we can use to declare variables: let and const. Using var for variable declarations has become somewhat superfluous and in almost all cases, let and const are better choices. But what is the difference?

Get hands-on with 1400+ tech skills courses.