Let
To create a variable in JavaScript, use the let keyword.
/**
* To create a variable in JavaScript, use the let keyword
*/
let name;
let message = "Hello World";
console.log(name); // undefined
console.log(message); // Hello World
let a = 1, b = 2; // not recommended
Questions and answers
Variables are visible through blocks when declared with:
- a) var
- b) let
Which one tolerates redeclarations
- a) let
- b) var
Assign a constant
- a) const PAGE_LOAD;
- b) const pageLoad;