Question: suppose i have an array in Javascript with several objects in it. var data = [ { name: Jack, mobile: 1234, date: 2019-01-15 13:42:11}, }
suppose i have an array in Javascript with several objects in it.
var data = [
{
name: Jack,
mobile: 1234,
date: 2019-01-15 13:42:11},
}
{
name: Jack,
mobile: 1234,
date: 2019-01-13 10:35:55},
}
{
name: Jack,
mobile: 1234,
date: 2019-01-13 9:20:55},
}
{
name: Mike,
mobile: 1234,
date: 2019-01-13 12:35:55},
}
{
name: Mike,
mobile: 1234,
date: 2019-01-13 9:30:55},
}
{
name: Mike,
mobile: 1234,
date: 2019-01-13 05:25:55}
how to make a function that takes this array and returns the new array with objects, that only have the latest date. Notice that each object( name) has arrived at different time. so for each name, need the latest time to arrive
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
