Problems

Sort Players by Score

MediumArrays & Objects

Read a JSON array of players {"name": string, "score": number}. Sort by score descending; ties break alphabetically by name. Print the sorted names as a JSON array.

Input: one JSON array. Output: JSON array of names.

Your program reads from stdin and prints to stdout.

Example 1

Input: [{"name":"bo","score":5},{"name":"al","score":9}]

Output: ["al","bo"]

Hints

JavaScriptSortingObjects