4 ms·
> Block scoping is default now in JS The default best practice, you mean? Declaring with 'var' will still get you the same lexical scoping rules as always. I
by MaxfordAndSons 9y ago
> Block scoping is default now in JS
The default best practice, you mean? Declaring with 'var' will still get you the same lexical scoping rules as always.
I believe OP meant 'inherited from pre-ES6 JS'
- positivecomment 9y agoI thought using "var" is deprecated... If there's anyone who has the chance to use let/const but still doesn't, I'd be very curious to learn about their reasoning
- seangrogg 9y agoBad habits, arguably. Been using JS for years so occasionally instances where a more vigilant self would use "let" still get "var" instead. I think part of this is because of issues with previous versions of v8/node where using let at the global level or without 'use strict' threw errors. That being said, "const" is already hardwired.
- hippich 9y agoto get variable defined in function scope? :)
- vazhifarer 9y agoI know right. Principle of least Privilege. Simple.