How can I sort this array based upon id ?
const arr = [{
"id": 38938888,
"subInternalUpdates": true,
},
{
"id": 38938887,
"subInternalUpdates": true
},
{
"id": 38938889,
"subInternalUpdates": true
}
];
const sorted_by_name = arr.sort((a, b) => a.id > b.id);
console.log(sorted_by_name);
expected output
const arr = [
{
"id": 38938887,
"subInternalUpdates": true
},
{
"id": 38938888,
"subInternalUpdates": true,
},
{
"id": 38938889,
"subInternalUpdates": true
}
];