Generally, you can replace some comments with variable names or comment names. Which means you must already be in the habbit of extracting methods, setting new variables to use appropriate names, and limit context to reduce the name (Smaller classes and methods means shorter names can be just as expressive, because the context is clearer). It lowers the number of wtfs per minute you get reading code before you even need whole sentences to explain why things are done in a certain way, because the names can be a powerful hint.
But realistically, you end up needing comments for some things anyways.
Yes and no. I mean sure, if you are going to leverage this to gain a significant edge in the market, that works.
If you add a tool to the project, that you need to understand to maintain some parts of it, which adds to the learning curve of someone joining said team, then the gains have best be worth the effort.
We adopt so many librairies/plugins/tools over time that adding more complexity than you need this way is just terrible.
Yeah, but it’s easy to overuse it. If your for loop is much longer. For a few lines I’d agree, don’t bother using something longer.
Code should scream out it’s intent for the reader to see. It’s why you are doing something that needs to be communicated, not what you are doing. “i”, “counter” or “index” all scream out what you are doing, not why. This is more important than the name being short (but for equal explanations of intent, go with the shorter name). The for loop does that already.
If you can’t do that, be more precise. At the least make it “cardIndex”, or “searchIndex”. It makes it easier to connect the dots.
It has a rocky start, and a lot of cruft from that era sticked around.
There are also a lot of horrible legacy projects from the pre-ES5 era which are a pain to work with. Often older projects were coded either before people knew how to do javascript right, or before the devs who wrote it knew how to write javascript right.
I think this depends on the crowd. Unfortunately, the intelligent crowd and the crowd with money and power is not exactly the same. Though hopefully there is overlap.