JavaScript has array methods like indexOf
and find
for getting the first element in the array that matches the criteria. The counterpart to indexOf
would be lastIndexOf
, which searches starting from the end of the array instead. I'm wondering now if there is a counterpart to find
that starts from the end of the array, like a native implementation of Ramda's findLast
.
I would prefer to use neither array.slice().reverse().find()
due to performance costs nor a for
loop as it is verbose and not in the spirit of functional programming