Finding the index
Exercise 1
- Finding the index of the first even number:
- Create an array of numbers.
- Use findIndex() to find the index of the first even number.
Exercise 2
- Finding the index of the first string starting with 'a':
- Create an array of strings.
- Use findIndex() to find the index of the first string that starts with 'a'.
Exercise 3
- Finding the index of the first object with a specific property value:
- Create an array of objects with properties like name and age.
- Use findIndex() to find the index of the first object where age is greater than 30.