Return the index of the maximum value in the array.
@param array - an array of numerical values
@return the index of the largest value in the array.
function argMax(array) {
    var maxIndex = 0
     , i
     ;
    for (i = 0; i < array.length; i++) {
      if (array[i] > array[maxIndex]) {
        maxIndex = i;
      }
    }
    return maxIndex;
  }