Skip to content
Advertisement

Create a function to sort the array of objects by three specific keys

I have the array of objects: the cars with the data. And I have a given sorted array of objects – these cars sorted by colors (red, black, other) and nested inside. Here you can take a look: JSFiddle – Two Arrays, unsorted and sorted

Which array method is better to use to create something like that? And I wouldn’t like to mutate the given array.

JavaScript

Advertisement

Answer

“group by array of objects using reduce”

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