DEV Community

Discussion on: Which types of loops are most popular in the programming languages you use?

Collapse
 
ahferroin7 profile image
Austin S. Hemmelgarn

Ruby is not as unique in that respect as you think.

There are not one, not two, but three ways to loop over an array in JavaScript, and that's not counting special cases like map, reduce, or filter. You have classic C-style for loops, 'for...of' loops (iteration), and the callback-based .forEach() approach.