Array Cardio Day Two 💪💪

Array.prototype.some() - Returns true if at least one element in this array satisfies the provided testing function.

Array.prototype.every() - Returns true if every element in this array satisfies the testing function.

Array.prototype.find() - Returns the found element in the array, if some element in the array satisfies the testing function, or undefined if not found.

Array.prototype.findIndex() - Returns the found index in the array, if an element in the array satisfies the testing function, or -1 if not found.

Some data we can work with:

People Array Comments Array

Exercise 01 - .some()

Is at least one person 19 or older in the people array?

Code

Code Exercise 01

Output

Output Exercise 01

Exercise 02 - .every()

Is everyone 19 or older?

Code

Code Exercise 02

Output

Output Exercise 02

Exercise 03 - .find()

Find the comment with the ID of 823423 in the comments array

Code

Code Exercise 03

Output

Output Exercise 03

Exercise 04 - .findIndex()

Find the index of the comment with ID of 823423

Code

Code Exercise 04

Output

Output Exercise 04

Exercise 05

Delete the comment with the ID of 823423

Code

Code Exercise 05

Output

Output Exercise 05