re: How to loop through object in JavaScript(es6) VIEW POST

FULL DISCUSSION
 

A common misconception among beginners is that you have to use the let keyword in a for ... in loop because the variable changes with each iteration. That is not true. You can use const because a new variable with the same name gets allocated in each iteration block and gets deleted at the end of each loop.

 

Nice little tip that totally makes sense, I always assumed it was outside scope because, well, that's how I've always seen it written!
But it's nice to finally see the misconception cleared up.

code of conduct - report abuse