JavaScript 30 — Day 7 - Array Cardio 2
1 min readDec 7, 2021
I went back to visit family over the weekend and I fell behind a little with both the coding and my documentation of the challenge.
The purpose of this challenge, for me, was not designed for stringent daily practice but rather a good guideline of what is easily digestible in daily increments.
In any case, I am back and have a backlog to share.
This day’s exercise was relatively uneventful but nevertheless useful. As a sequel to Day 4’s Array Cardio session, it dives into a few more Array methods:
- some
- some() is a handy method that will return a boolean value True if the condition is met for any of the array elements - every
- every() on the other hand is similar to some() but, you guessed it, only returns True if the condition is met for ALL the array elements - find
- I like to think of find() as like a singular use of filter(). Find () will return the first element that that satisfies the condition.
- However these two aren’t exact comparisons since filter() will still return an array even with just one element in it if that is the case. - findIndex
- Just like find() but it returns the index of the element rather than the element itself.