Why does it work with ads var
JavaScript var, ( , "use strict").
, typeof , , , .
(TDZ)
TDZ ECMAScript, , let const .
const let
JavaScript let const, TDZ. TDZ .
TDZ , .
console.log(typeof undeclaredLetConst);
if (1) {
let undeclaredLetConst = "no errors!";
}
undeclaredLetConst isnt TDZ, typeof, , undeclaredLetConst. , , typeof "undefined".
: . , ECMAScript 6.