We're a place where coders share, stay up-to-date and grow their careers.
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.
forEach
for ... in
for ... of
Thank you!
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 alsofor ... in
andfor ... of
loops where you don't have to care about indexes.Thank you!