return default index when not found
This commit is contained in:
@ -6,3 +6,6 @@ test('findLastIndex is a Function', () => {
|
||||
test('Finds last index for which the given function returns true', () => {
|
||||
expect(findLastIndex([1, 2, 3, 4], n => n % 2 === 1)).toBe(2);
|
||||
});
|
||||
test('Return default index when not found', () => {
|
||||
expect(findLastIndex([1, 2, 3, 4], n => n === 5)).toBe(-1);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user