DEV Community

Discussion on: I Use For Loops Almost Always In Javascript

Collapse
 
beggars profile image
Dwayne Charrington

I love for..of loops, they are the only kind of for loop I really write these days. Especially being able to do something like for (const value of object.entries()) which makes working with different types of data (not just arrays) so much nicer.

There are definitely some traps you can fall into (side effects from modifying the reference if you forget to create a new array/collection) but if you're aware of them, it's not much of a problem.