Learning what linting is has saved me so much time and energy with hammering in simple syntax rules like that.
Another thing I'd say is to learn DOM manipulation first. I got stuck for a month or two on using JS to solve algorithmic problems in online courses like free code camp, but after I had a solid grasp on JS I still had no freaking idea how to actually use it. Starting with the basics of selecting an element and adding a listener would have been a huge boon to my progress.
Yeah that’s one of the huge advantages of JavaScript. The visual feedback loop is so much faster with JavaScript than with a lot of other languages, simply because it works in the browser. And building UI with it is a breeze in comparison to other things.
I imagine it can be more convinent sometimes to have a function-scoped variable. But even then we're probably talking about quickly hacking things together.
Out of the blue I cannot give you a production example of "a var variable would be better here"
It's not an IDE that errors anything, it's linters. And VSCode comes with ESLint which gives a warning for var usage with default rules, so idk what you're talking about.
Gotta shake that attitude, if adjusting how you code makes you really upset, you are setting yourself to have a bad time in this industry.
I use airbnb core, but with a few rules adjusted to my liking. It took a while to get used to, and some of my teammates complained, but you know what, now our PRs all look consistent. I don’t care how much people complain, it’s worth it
protip: edit the config to only warn (or even disable) some stuff while writing (whitespace stuff mostly), and fix all of them at once before deployment. saved me a ton of nerves
I don't know, if you're a beginner that just started learning JS in the last couple of years, virtually every resource (at least in my experience) hammers down let and const pretty much right away, or at least very early on.
Yet if you pay attention to the beginner questions asked here and other places, a lot of them use var instead of const or let. That is mostly because a lot of schools/universities/whatever aren't that good at keeping up
141
u/inabahare May 28 '19
Using const and let