I have an array of objects, where I am checking for a boolean property, I need to get the last one from the array of objects which is true and need to get the name property.
This is what I have done, is there any better approach or simple way to achieve this:
const a = [{is_done: true, name: 'a'}, {is_done: true, name: 'b'}, {is_done: false, name: 'c'}]
let output = a.filter(a => a.is_done).slice(-1)[0].name
console.log(output)