So i have an array of objects which have some data like so:
[
{
id:4390,
name:panadol
},
{
id:4392,
name:aspirin
},
{
id:1390,
name:vantage
},
{
id:2390,
name:cream
},
]
Currently they are being displayed in the same order i would say or roughly the same there is too much data so. anyways say another array of objects is fetched from the server after searching with keyword and that looks like this:
[
{
id:3390,
name:morphine
},
{
id:3231,
name:flagyl
},
]
So after this array is merged in the orignal array how can i sort it so that the newest data is displayed first.