Lassen Sie JavaScript
The let statement declares a block-scoped local variable,
optionally initializing it to a value.
let x=1;
Real Raccoon
The let statement declares a block-scoped local variable,
optionally initializing it to a value.
let x=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
// variable declared using let
let name = 'Sara';
{
// can be accessed only inside
let name = 'Peter';
console.log(name); // Peter
}
console.log(name); // Sara