var, let, and const

What are the differences between var, let, and const keyword?

The main difference is that var variables are function scoped and the let and const variables are block-scoped.

This means that const and let variables are only accessible from their top block scope while var ones are accessible from their function top scope.

Last updated