The conversation between human and AI assistant.
How do I write an algorithm to find the nth highest number in an array?
Yes, please. Can you also explain to me how the code works?
Of course! Here's the code:

```
function findNthHighest(arr, n) {
  arr.sort((a, b) => b - a);
  return arr[n-1];
}
```

First, we sort the array in descending order with `.sort((a, b) => b - a)`. Then we return the element at index `n-1` with `return arr[n-1]`. This will give us the nth highest number in the array.