Please what is the difference between map(), filter() and reduce() array method in Javascript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Please what is the difference between map(), filter() and reduce() array method in Javascript

8th Nov 2019, 12:59 PM
Emediong Harrison
Emediong Harrison - avatar
3 Answers
8th Nov 2019, 6:29 PM
Vladyslav Semeniuk 🐸
Vladyslav Semeniuk 🐸 - avatar
+ 2
Map performs an operation on each element in the array, much like foreach. Filter, like it says filters out the result based on some criteria e.g. all items less than 5 Reduce performs a summing operation on the array
9th Nov 2019, 10:41 AM
Logomonic Learning
Logomonic Learning - avatar
+ 2
Thanks
26th Nov 2019, 9:19 PM
Emediong Harrison
Emediong Harrison - avatar