re: I Use For Loops Almost Always In Javascript VIEW POST

re: For loops can be clean. In ES6 we got for..of loops, they are declarative and work with more data types than just arrays. for (let variable of it...

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.

Code of Conduct Report abuse