title: How to get the index of the largest value in an array? JavaScript
body: <p>I need to get the index of the largest value in the array connections. This array is used to output values to a table, I need to be able to then set the cell in this table with the largest value to be red. Here is what I have so far:</p>
  
  <pre><code>cells[0].innerHTML = connections[0];
  cells[1].innerHTML = connections[1];
  cells[2].innerHTML = connections[2];
  cells[3].innerHTML = connections[3];
  cells[4].innerHTML = connections[4];
  cells[5].innerHTML = connections[5];
  cells[6].innerHTML = connections[6];
  cells[7].innerHTML = connections[7];
  cells[8].innerHTML = connections[8];
  cells[9].innerHTML = connections[9];
  
  cells[].style.backgroundColor = "red";
  </code></pre>
  
  <p>How would I go about finding the index of the biggest value in the connections array and setting the position of cells[] to it. I have tried using a loop and if statement to find the value but I then had trouble with getting that value out of the loop.</p>