“JavaScript let” Code-Antworten

Lassen Sie JavaScript

The let statement declares a block-scoped local variable, 
  optionally initializing it to a value.
let x=1;
Real Raccoon

Lassen Sie JavaScript

* 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
Rht

JavaScript let

// variable declared using let
let name = 'Sara';
{
    // can be accessed only inside
    let name = 'Peter';

    console.log(name); // Peter
}
console.log(name); // Sara
SAMER SAEID

Ähnliche Antworten wie “JavaScript let”

Fragen ähnlich wie “JavaScript let”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen