Differences between VAR, LET AND CONST KEYWORD

var let and const This are Javascript reserved keywords

The keyword var has been in Javascript from the very beginning it was introduced to the world while let and const was introduced the moment ECMASCRIPT became a thing in Javascript which came in to reform somethings.

Let's quickly take a look at this below:

let a;  // declaration
var b; // declaration
const c = 5;  // declaration & Assignment

If you'd see what i just did, i only made a declaration on var and let while in const not only did i make a declaration, i also assigned it to a value. Now goes one of the difference between 3 of the keywords which is let & var can be declared without assigning a value to it but in the case of const it can't be declared without assigning a value to it.

Another Example:

let a = 10;
a = 20;

var b = true;
b = false;

const a = 5;
a = 10;  // TypeError: Assignment to constant variable.

The let and var are now assigned to a value and there's the common thing about them is that they can be updated while assigning another value to the declared variable meanwhile in const it can't be reassigned neither can it be re-declared, doing this will throw a TypeError.

IN SCOPE TERMS

let and const are in block scope this means that it's generally used in a switch conditions or for and while loop statement and only exist in a corresponding block.

let's quickly site an example:

for(let i=0;i<10;i++){
 console.log(i);
 }
 console.log("The value of i:" + i)

or

function (onSubmit) {
   const user = 'EntryToken'
   if 
}