“JavaScript Let” Kode Jawaban

Biarkan JavaScript

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

Biarkan 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

Jawaban yang mirip dengan “JavaScript Let”

Pertanyaan yang mirip dengan “JavaScript Let”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya