How to sort elements in array as per time parameter?
The time values in array can be sorted as strings. Below is the source code for same:
array.sort((a, b) => a.time.localeCompare(b.time));
Looking for change? Click below to prepare for technical interview.
Technical Interview Questions