DEV Community


Discussion on: In JS how do you know the right condition to use inside your for loop?

aakatev profile image

If you struggle with it, you are no alone.

That's why modern languages introduces a concept of iterator or iterator methods. In JS, you can use forEach to achieve similar purpose of a for loop. There are also for ... in and for ... of loops where you don't have to care about indexes.

scothinks profile image
Forem Open with the Forem app