Sort an array of composite structures
Write a function that takes an array of objects as a parameter. The function should sort the array according to the 'key' attribute of the objects and return the sorted array.
Test
{{test}}Console output
Write a function that takes an array of objects as a parameter. The function should sort the array according to the 'key' attribute of the objects and return the sorted array.
Use Cmd instead of Ctrl if you're on a Mac.
g | Focus editor |
Ctrl-Enter | Run the test with current code |
Ctrl-Shift-K | Reset the editor |
Ctrl-Shift-L | Clear console output |
Ctrl-Shift-X | Show the solution |
[ | Previous challenge |
] | Next challenge |
T | Back to top page |
? | Show this dialog |
ESC | Hide this dialog |
Shift-ESC | Blur focus from editor |