i want to sort in descending order the date value if the name value match with the name property of each element of an array, how can i do?
This is my code:
var name = 'Mario'
array = [
{name:'Mario',
date:'/Date(16487438090000)/' },
{name:'Mario',
date:'/Date(16887438090000)/' },
{name: 'Koala',
date:'/Date(1658743809000)/' },
{name: 'Jhon',
date:'/Date(1668743809000)/' },
]
array.forEach(function(obj){
if(name === obj.name){
/*{name:'Mario',date:'/Date(16887438090000)/' }{name:'Mario',date:'/Date(16487438090000)/' },,*/
//sort date descending
}
})
'/Date(16487438090000)/'
? - jarmod