Sortuj JSON w kolejności malejącej

const data = [
    {id: 1, name: "Bob", email: "[email protected]"},
    {id: 2, name: "Tom", email: "[email protected]"},
    {id: 3, name: "Cat", email: "[email protected]"},
    {id: 4, name: "Mat", email: "[email protected]"},
	{id: 5, name: "Tim", email: "[email protected]"},
];

let sortedData = data.slice().sort((a, b) => b.id - a.id);
console.log(sortedData);
Cautious Capybara