You can use the findIndex() method on Arrays in Javascript to search through an array and find the index of an element which meets/satisfies a testing condition that you pass in through a function.
For your reference:
https://developer.mozilla.org/en-US/d...
If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!