let and const support
ES6 let
and const
declarations are now supported when targeting ES3 and ES5.
Const
const MAX = 100;
++MAX; // Error: The operand of an increment or decrement
// operator cannot be a constant.
Block scoped
if (true) {
let a = 4;
// use a
}
else {
let a = "string";
// use a
}
alert(a); // Error: a is not defined in this scope