How can the data returned by the backend be sorted according to id?

`[

{name:a,id:1},
{name:c,id:5},
{name:b,id:2},
{name:y,id:4},
{name:s,id:6},
{name:p,id:3},

] `

how to sort from small to big according to id? It"s confusing whether
should use filter or map.

Aug.24,2021

var ary = [

{name:1,id:1},
{name:2,id:5},
{name:3,id:2},
{name:4,id:4},
{name:5,id:6},
{name:6,id:3},
]

console.log(ary.sort(function(x,y) {return x.id - y.id})
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3bb69-2c2cc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3bb69-2c2cc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?