3 ms·
I always go with plural for lists and singular for iteration variables. for (let thing of things) {...}
by tomatsu 10y ago
I always go with plural for lists and singular for iteration variables.
for (let thing of things) {...}
- TeMPOraL 10y agoPersonally I have a habit of avoiding that, especially in dynamic languages, because a single typo could have nasty consequences there. So I always figure out a synonym, or use a name for the variable that's either more descriptive: for (let particularThing of things) or at least visibly different: for (let th of thigns)
- tomatsu 10y agoThe dynamic languages I primarily use are TypeScript and Dart. I always have enough type information floating around to catch this kind of thing. But even in JavaScript it wouldn't be much of an issue since it will instantly explode on the first run, which is certainly inconvenient, but nothing major.