I have an array of objects stored in 'component' variable
component=[{id:1,date:'20-10-2020'},{id:1,date:'13-01-2020'},{id:2,date:'30-03-2020'}]
Here I'm having 2 objects with 'id' as same(id:1) but with different dates. If there are multiple objects with the same id in it, I need to take out only the id with the latest date. Is it possible with filters?
After filtering, I need the output like
component=[{id:1,date:'20-10-2020'},{id:2,date:'30-03-2020'}]
Here '{id:1,date:'13-01-2020'}' is removed from the array.
Thanks in advance