4 ms·
forEach returns undefined. Why would you not just return the same array for easy chaining?
by gear54rus 9y ago
forEach returns undefined. Why would you not just return the same array for easy chaining?
- brad0 9y agoProbably to make a distinction between map() which returns a new array. If forEach returned the same array I believe you'd would see a lot more bugs.