4 ms·
forEach is an outlier, because most of these methods transform something into something else and can be chained, and that's where the readability increase comes
by brundolf 5y ago
forEach is an outlier, because most of these methods transform something into something else and can be chained, and that's where the readability increase comes in. I usually prefer for loops over forEach because it emphasizes the fact that forEach doesn't return a value; it's used purely for the sake of side-effects.