r/angular • • Dec 30 '18

Eleven Ways To Learn Javascript Array Iteration Effectively - ZeptoBook

https://www.zeptobook.com/eleven-ways-to-learn-javascript-array-iteration-effectively/
3 Upvotes

4 comments sorted by

View all comments

8

u/kescusay Dec 30 '18

TL;DR: It's just an overview of these array functions:

  1. Array.map() - Make new arrays from old!

  2. Array.filter() - Get rid of something you don't want in the array!

  3. Array.forEach() - Do something with everything in the array!

  4. Array.reduce() - Make a new something-that-isn't-an-array from an array!

  5. Array.reduceRight() - Make a new something-that-isn't-an-array from an array, backwards!

  6. Array.some() - Check if at least one member of an array matches a condition!

  7. Array.every() - Check if all members of an array match a condition!

  8. Array.find() - Find the thing!

  9. Array.findIndex() - Find the spot where the thing you're looking for is!

  10. Array.indexOf() - Also find the spot where the thing you're looking for is!

  11. Array.lastIndexOf() - Find the spot where the last of the things you're looking for is!

There you go.

5

u/EleventyTwatWaffles Dec 30 '18

There seems to be a huge spike in total shit posted to this sub over the past week. Is it always this weak? I typically don’t have the time to read through it like I did this week

4

u/kescusay Dec 30 '18

It definitely seems to be kinda shitty for the holiday season. I mean, there's nothing wrong with an overview of Array functions per se, but it doesn't need to be nearly this long, it doesn't need to have this many misspellings, and it doesn't need to pretend that this is some sort of deep JavaScript knowledge. If someone doesn't know how to do a forEach loop, that's someone who should be taking basic programming courses.