title: javascript grade calculating and average
body: <p>This is my HTML code, for some reason this code only takes three values , it doesn't take more than three values, and when I try to enter more, it displayed only the first three values I entered. Something is wrong with my code but I couldn't figure it out. Please help.</p>
  
  <pre><code>var gradeCounter, gradeValue, total, average, grade;
  
  total = 2;
  gradeCounter = 0;
  grade = prompt("enter grade, -1 to Quit:", "0");
  gradeValue = parseInt(grade);
  
  while (gradeValue != -1 &amp;&amp; gradeValue &gt; 65) document.write("&lt;br&gt;" + gradeValue + " pass&lt;/br&gt;");
    total = total + gradeValue;
    gradeCounter = gradeCounter + 1;
    grade = prompt("enter grade, -1 to Quit:", "0");
    gradeValue = parseInt(grade);
  }
  
  if (gradeCounter != 0 &amp;&amp; gradeValue &lt;= 65) {
      document.write("&lt;br&gt;" + gradeValue + " fail&lt;/br&gt;");
  
      total = total + gradeValue;
      gradeCounter = gradeCounter + 1;
      grade = prompt("enter grade, -1 to Quit:", "0");
      gradeValue = parseInt(grade);
      average = total / gradeCounter;
  
      document.write("&lt;br&gt;total grade: " + gradeCounter + "&lt;/bt&gt;");
      document.write("&lt;br&gt;average passing grade:" + average + "&lt;/br&gt;");
  } 
  else document.write("total grade:" + 0);
  </code></pre>