Asked 7 years ago
11 Jan 2017
Views 998
yogi

yogi posted

use of let keyword in JavaScript ?

what is use of let keyword in JavaScript ?

let obj = {}

what is meaning of let keyword in JavaScript?
how to use let keyword in JavaScript ?
is there any practical use of let keyword in JavaScript ?
Rasi

Rasi
answered Nov 30 '-1 00:00

let statement define variable to particular that scope


let d='n';
{
let d='name';
  console.log(d);//name
}
  console.log(d);//n

both d is not same here . its differ variable at differ stage. { } is enclose differ block , in which let d is differ new variable.

where var statement define it globally , let statement define locally

let make variable to private in closure.

Post Answer