DEV Community

Discussion on: "for" vs. "forEach" and the value of documentation

Collapse
 
oathkeeper profile image
Divyesh Parmar

And one thing to remember for interviews is that none of them returns a new array ( or iterable ) only Array.prototype.map() returns a new array or iterable

this has what confused me a lot in few of my interviews from those harsh 73 interviews.

Collapse
 
qm3ster profile image
Mihail Malo

filter returns a new array as well.
And in cases where it's used as a map+filter optimization, so does reduce (but not in other cases).

Collapse
 
qm3ster profile image
Mihail Malo

Idk, they're really easy to find, I don't have a specific source.
This seems adequate enough: medium.com/jsguru/javascript-funct...

Collapse
 
oathkeeper profile image
Divyesh Parmar

can you please elaborate on this more or give some references articles/blogs to read from?