Javascript check for Max/Min/Average number from a record set
<pre><code>function lab09unknownLoopCountPart2() {

//Constants
var ONE_HUNDRED = 100;
var ZERO = 0;

//Variables
var employeeHourlyWage;
var hourlyMaximum = ZERO;
var hourlyMinimum = ZERO;
var totalHourlyWage = ZERO;
var records;
var counter = ZERO;
var average;

records = openEmployeePayrollRecords();

while (records.readNextRecord()) {
   employeeHourlyWage  = records.getEmployeeHourlyWage();
   totalHourlyWage += employeeHourlyWage;
   counter++;
   average = totalHourlyWage / counter;

   if (employeeHourlyWage &lt; ONE_HUNDRED) {
       hourlyMaximum = employeeHourlyWage;
   }
   if (employeeHourlyWage &lt; ONE_HUNDRED) {
       hourlyMinimum = employeeHourlyWage;
   }
}
document.write("Average Hourly Wage: " + average + "&lt;br /&gt;");
document.write("Maximum Hourly Wage: "  + hourlyMaximum + "&lt;br /&gt;");
document.write("Minimum Hourly Wage: " + hourlyMinimum + "&lt;br /&gt;");
</code></pre>

<p>}</p>

<p>The record set is simply numbers from 15 - 30. I have to sort through them and find the Maximum, Minimum and Average.</p>

<p>I know that my two IF statements are incorrect and I'm wondering how to check this, <strong>without</strong> using Math.min and Math.max.</p>

<p>Thanks.</p>
