function findIndex( array, condition ) {

    for ( let i = 0; i < array.length; ++i ) {

        if ( condition( array[ i ], i ) ) return i;

    }

    return -1;

}
The `findIndex()` method returns the index of the first element in the array that satisfies the
provided testing function, otherwise `-1` is returned.