JS var vs let
let = 10 // accessable only in defined scope
var = 10 // accessable in the function it is declared in (global variable in a function)
katanton reckless
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