DEV Community

Discussion on: Understanding the .map(), .filter() and .reduce() array methods in Javascript.

Collapse
 
jonrandy profile image
Jon Randy 🎖️ • Edited

Yeah, definitions vary... but I do feel it introduces unnecessary confusion - especially when not explained clearly (which I am indeed a little guilty of above). I see people refer to passed functions as 'callbacks' even when they are not called - i.e. in a function that wraps the passed function then returns the wrapped version - so confusion clearly exists. It is not as simple as 'every function passed to another function is a callback function', which I've heard variations of from many junior devs / interviewees.

The key part in the Wikipedia definition is:

that code is expected to call back (execute) the callback function as part of its job

Thread Thread
 
frankwisniewski profile image
Frank Wisniewski

for me it's just a function. Some see it differently. It's getting on my nerves that filter, map and reduce are talked about here every few days.....

Thread Thread
 
jonrandy profile image
Jon Randy 🎖️ • Edited

Haha, yep. Dev should introduce a feature when you post to check if you're effectively reposting content from existing documentation, and attempt to discourage you from doing so.