Caitlin Potter (2016-09-14T22:52:00.000Z)
caitpotter88 at gmail.com (2016-09-14T22:52:51.492Z)
> On Sep 14, 2016, at 6:41 PM, Jordan Harband <ljharb at gmail.com> wrote: > > While I like the idea of making it simpler to restrict the scope of variables, currently a reigning best practice is to never do assignment in conditionals, since it can be an easy typo from `==` or `===`, and because it conflates assignment with expression truthiness, harming readability. > > This seems like it runs afoul of the latter, certainly, and I haven't yet convinced myself whether it creates typo hazards (I'm thinking no, but wanted to bring it up just in case). Given that `let x == 10` or `let x === 10` is illegal, it doesn’t seem too bad to allow `if (let x = f(y))`, LexicalDeclaration is visually distinct from EqualityExpression because of the `let` or `const` prefix.