3 ms·
Besides yet another "damn, Javascript is whack" article, I thought a lot of the details were actually really interesting, and stuff that I either outright didn'
by hn_throwaway_99 2y ago
Besides yet another "damn, Javascript is whack" article, I thought a lot of the details were actually really interesting, and stuff that I either outright didn't know or had just forgotten because I use TypeScript and a lot of these thing would make the TS compiler complain.
For example, I can't remember the last time I used the `var` keyword, and I had either forgotten or never really realized it had subtly different semantics compared to `let` and `const`, e.g. with respect to hoisting rules.
- tstrimple 2y agoWhich in this case most folks have moved on to let and const. But tons of code in the wild is still sprinkled with var. If you’re mostly working greenfield JavaScript, you can ignore a lot of the warts and have a pretty good experience. If you’re working on a lot of legacy stuff you’ll see mixed use of var and let and it’s quite helpful to understand the differences more fully.