The let statement declares a block scope local variable, optionally initializing it to a value.
let x = 1;
if (x === 1) {
let x = 2;
console.log(x);
// expected output: 2
}
console.log(x);
// expected output: 1
* Variables defined with let cannot be redeclared.
* You cannot accidentally redeclare a variable.
let x = "John Doe";
let x = 0;
// SyntaxError: 'x' has already been declared
allows you to declare variables that are limited to the scope of a block statement