 # Sort People by Height

Easy
15
3
44.6% Acceptance

In this lab, you are tasked to implement a function called `sortPeople` that sorts an array of names based on their corresponding heights in descending order. The function accepts two input arrays, one for the names and another for the corresponding heights of the individuals. The arrays are guaranteed to have distinct heights for each person.

You need to use ESM import/export everywhere.

Function signature:

``````/**
* @param {string[]} names
* @param {number[]} heights
* @return {string[]}
*/
var sortPeople = function(names, heights) {

};``````

Examples:

Example 1:

``````sortPeople(["Mary","John","Emma"], [180,165,170])
// Output: ["Mary","Emma","John"]
// Explanation: Mary is the tallest, followed by Emma and John.``````

Example 2:

``````sortPeople(["Alice","Bob","Bob"], [155,185,150])
// Output: ["Bob","Alice","Bob"]
// Explanation: The first Bob is the tallest, followed by Alice and the second Bob.``````

Constraints:

• `n == names.length == heights.length`
• `1 <= n <= 103`
• `1 <= names[i].length <= 20`
• `1 <= heights[i] <= 105`
• `names[i]` consists of lower and upper case English letters.
• All the values of `heights` are distinct.

Make sure to export the `sortPeople` function, as it will be used in the evaluation script to test your implementation.