I am sorry if this is asked already but as I am introducing myself in ES6 on some tutorials, the instructor is saying that the var statement should be avoided. It just feels wrong but, is there any good reason for why should it be avoided?
var is on ES6 for legacy reasons. In theory, the let statement is better since it behaves more predictably on block scopes, but it won't work with more outdated interpreters. So, if you're coding with only ES6 in mind, go for let.
EDIT: Also, keep in mind that if you're new to JS, you'll likely find more learning material using var, so keep that in mind.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With