[{ id: 8 }, { id: 3 }, { id: 2 }].sort((a, b) => (a.id - b.id));
[{ id: 2 }, { id: 3 }, { id: 8 }].sort((a, b) => (b.id - a.id));
const sortBy = (array, key, ascending = true) => array.sort((a, b) => (ascending ? (a[key] - b[key]) : (b[key] - a[key])));