Skip to content
Advertisement

Sort array of objects by single key with date value

I have an array of objects with several key value pairs, and I need to sort them based on ‘updated_at’:

JavaScript

What’s the most efficient way to do so?

Advertisement

Answer

You can use Array.sort.

Here’s an example:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement