Sorting an array of objects by number, string, date in Typescript code example
Example: sort array by date typescript
array.sort((x, y) => +new Date(x.createdAt) - +new Date(y.createdAt));
array.sort((x, y) => +new Date(x.createdAt) - +new Date(y.createdAt));