📅  最后修改于: 2022-03-11 15:01:50.400000             🧑  作者: Mango
const data = [
{id: 1, name: "Bob", email: "example@email.com"},
{id: 2, name: "Tom", email: "example@email.com"},
{id: 3, name: "Cat", email: "example@email.com"},
{id: 4, name: "Mat", email: "example@email.com"},
{id: 5, name: "Tim", email: "example@email.com"},
];
let sortedData = data.slice().sort((a, b) => b.id - a.id);
console.log(sortedData);