Available in Chrome 41+
Lexical declarations introduce new declaration forms for defining variables using the
let
and const
keywords
let
is similar to var
, but defines a variable limited in scope to the block,
statement or expression in which it is used. This differs from the var
keyword, which defines variables globally or local to a function regardless of block scope.const
is similar to let
, but for constant declarations that are read-only.