let

let – Declares one or more block scope variables, and optionally sets a value to them.

Description

let mixed variable, …

Parameters

Name Description Type Default Optional
variable, … One or more variable values to be set. mixed No

Changelog

Version Description
ES 6 Introduced.

Examples

Example #1 – let example
'use strict'; function doit () { let x = 'y'; // Sets "y" an the value for the variable named x. console.log(x); } doit();
'use strict'; function doit () { let a = 'b', x = 'y'; console.log(a); console.log(x); } doit();

External references