Re: QtSphere IDE (working title) 0.2.3
Reply #70 –
I think a lot of new JS programmers get thrown off by the hoisting behavior of var. For example, this is confusing:
// console.log(y); // strict mode error
console.log(x); // undefined (!)
var x = 812;
console.log(x); // 812
Versus:
// console.log(x); // error (TDZ)
let x = 812;
console.log(x); // 812
And block-scoping means that if you have a let in an inner block, such as an if condition or loop, it doesn't get hoisted outside like a var would. That one catches a lot of people off-guard, myself included when I first started learning JS, because it differs from how scoping works in almost every other C-like language.
...which brings me to the goofiness of the "temporal dead zone" terminology. For that I'll just quote a post I saw a year or so ago: