Returns the last index of the first continuous group of a given value. Strict equality (===) is used to compare elements.
===
Time complexity: O(n)
Space complexity: O(1)
The iterable to search
The value to search for
The last index of the first group of a given value
const iterable = ['a', 'a', 'b', 'b', 'c', 'c'];lastIndexOfFirstGroup(iterable, 'a'); // 1 Copy
const iterable = ['a', 'a', 'b', 'b', 'c', 'c'];lastIndexOfFirstGroup(iterable, 'a'); // 1
firstIndexOfLastGroup to do the same thing but find the first index of the last group
Iterable
Returns the last index of the first continuous group of a given value. Strict equality (
===
) is used to compare elements.Time complexity: O(n)
Space complexity: O(1)