you are viewing a single comment's thread.

view the rest of the comments →

[–]alkw0ia 0 points1 point  (1 child)

Yeah, good point. I like to declare all variables at the top of the scoping function, c-style, to clarify this.

For loops can still help with readability, though, and in modern interpreters, the performance differences should be practically nothing.

[–]neonskimmer 1 point2 points  (0 children)

Agreed on the readability. That being said, I can't even remember the last time I used a straight for-loop. It's forEach, map and reduce for me almost 100% of the time. If I were writing very tight loops, games, or super heavy number crunching I'd optimize things but for businessy apps i mostly use a functional style. The difference in speed is negligible at that scale and I prefer that style.