js
array.findLast((item, index, array) => boolean)find بترجّع أول واحد، findLast بتدور من الآخر. الاتنين بيقفوا عند أول تطابق من ناحيتهم، فمش بيلفّوا على الـarray كلها.
البرهان
js
const events = [{ id: 1, ok: false }, { id: 2, ok: true }, { id: 3, ok: true }];
console.log(events.find((e) => e.ok).id);
console.log(events.findLast((e) => e.ok).id);
console.log(events.findLast((e) => e.ok === 'x'));
console.log([1, 2, 3].findLast((n) => n > 10));النتيجة
2 3 undefined undefined