Hacker News new | ask | show | jobs
by tomatsu 3450 days ago
I always go with plural for lists and singular for iteration variables.

  for (let thing of things) {...}
1 comments

Personally 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)
The 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.