3 ms·
is it still common practice to use "var"?
by Polarity 4y ago
is it still common practice to use "var"?
- umvi 4y agoI think "let" and "const" are preferable
- hotz 4y agoDoesn't const also get optimized better?
- edflsafoiewq 4y agoNo, var should never be used.
- tuukkah 4y ago... because var is function-scoped, not block-scoped like let.
- Tade0 4y agoNo, but it's still useful in those rare instances in which you really need broader than block scoping.
- rom-antics 4y agoEven then I still think it's clearer to put a `let` in the outer scope instead of putting a `var` in one of the inner scopes.
- dgb23 4y agoI don’t see a good reason to use it. When I want to change a value later I use let at the top of the appropriate block, otherwise const. The code reads nicer that way.