Differences between declaring variables using var, let and const.

Before the ES6 version of javascript, only the keyword var was used to declare variables.

With the ES6 Version, keywords let and const were introduced to declare variables.

keyword const let var
global scope no no yes
function scope yes yes yes
block scope yes yes no
can be reassigned no yes yes

Leave a Reply

Your email address will not be published. Required fields are marked *