findLast
Finds the last element for which the provided function returns a truthy value.
- Use
Array.prototype.filter()to remove elements for whichfnreturns falsy values. - Use
Array.prototype.pop()to get the last element in the filtered array.
Finds the last element for which the provided function returns a truthy value.
Array.prototype.filter() to remove elements for which fn returns falsy values.Array.prototype.pop() to get the last element in the filtered array.