let: //only available inside the scope it's declared, like in "for" loop,
var: //accessed outside the loop "for"
let = 10 // accessable only in defined scope
var = 10 // accessable in the function it is declared in (global variable in a function)
/* DIFFERENCE BETWEEN LET AND VAR */
//LET EXAMPLE
{
let a = 123;
};
console.log(a); // undefined
//VAR EXAMPLE
{
var a = 123;
};
console.log(a); // 123
var makes a grobal variable
let makes a local variable