Here's a possible solution:

```
function findSecondHighest(arr) {
  let highest = -Infinity;
  let secondHighest = -Infinity;
  
  for (let i = 0; i < arr.length; i++) {
    if (arr[i] > highest) {
      secondHighest = highest;
      highest = arr[i];
    } else if (arr[i] > secondHighest && arr[i] !== highest) {
      secondHighest = arr[i];
    }
  }
  
  return secondHighest;
}

let arr = [11, 2, 31, 7, 15];
let secondHighest = findSecondHighest(arr);

console.log(secondHighest);  // Output: 15
```

In this solution, we keep track of the highest and second highest numbers seen so far as we iterate through the array. We start with -Infinity as the initial values for both variables, assuming that the input array contains only positive numbers. If the current element is greater than `highest`, we update both variables accordingly. If the current element is greater than `secondHighest` but not equal to `highest`, we update `secondHighest`. Once we have gone through the whole array, `secondHighest` will contain the second highest number.
[11, 2, 31, 7, 15]
Scrivi una funzione in JavaScript che accetta un array di numeri come input e trova il secondo numero più alto nell'array.