Earlier quoted context omitted.
Here's a little bit for you. Most people prefer the semantics of `let` to `var` for variable declarations in JavaScript. It's how JavaScript should have been designed from the start. It has been officially standard for a year or two and became available in some browsers even earlier. I want to use `let` (and `const`) for everything and never use `var` again, but I couldn't even do that on my own PRIVATE website (for…
I get "const", but is "let" really that big a deal? Are your functions so deeply nested that you need block scope inside of if statements and for loops? (vs forEach callbacks or IIFE blocks or simply splitting complicated stuff into smaller functions) There is some cool stuff in ES6, but "let" is kind of a yawn, and "class" most definitely is NOT something I really needed. But I'm still running ES5 on IE11 at work, s…
let element = document.getElementById('some-element');
while (element) {
// do something
element = element.parentElement;
}
let doesn't get in the way with behavior such as hoisting, and the code will break if you redeclare a variable.