3 ms·
basically i feel like it greatly complicates the scoping rules in order to make javascript scoping similar to other languages scoping rules. If there was no 'va
by apalmer 11y ago
basically i feel like it greatly complicates the scoping rules in order to make javascript scoping similar to other languages scoping rules. If there was no 'var' I would be fine with 'let' and in theory perhaps 'let' is better than 'var', however if i had a choice between having both or having just one, i would rather just have either, even if the either is 'var'.
- spb 11y agoIf you think of `var` as a syntactic sugar for a `let` declaration that gets hoisted to the top of its containing function, `let` actually simplifies scoping.