DEV Community

Discussion on: Why you should stop declaring variables inside a for loop (especially in JavaScript)

technicaljohn profile image
Technical John • Edited on

Please look further down the comments for a comment by Jan Hasebos. It would address your perception regarding the iterated declaration, while also respecting the variable scope of the for loop.

Really, you'd be better off saying the "bad" example is ok, while you feel the "good" example is better.

I added some thoughts below Jan to expand on this.