title: change number grade to letter grade
body: <p>I had to create a function that will accept user input for the name and number grade for a series of student. I click on the add button to add the data to the array. Now I want to display the name and grade, but convert the number grade to letter grade. I have everything working except the number to letter change. My code will show you that i used a for loop with if else statements but it does not seem to be grabbing the data. Here is my code:</p>
  
  <pre><code>    html&gt;
      &lt;head&gt;
          &lt;meta charset=utf-8 /&gt;
          &lt;title&gt;Compute the average marks and grade&lt;/title&gt;
  
          &lt;link rel="stylesheet" type="text/css" href="Looping.css"&gt;
  
          &lt;meta REQUIREMENT=
              "Using JavaScript, create a function that will accept user
              input for the name and grade for a series of students.  As
              input is given, store information (name and grade) in an
              array.  Click the 'Add' button after entering each student's
              data.    Click the 'Display' button to display the name and grade
              for each student and, then, the average for all grades."&gt;
  
  
          &lt;script&gt;
  
  
              var userName, userAge;
              var nameData = [];
              var gradeData = [];
  
  
              function addToArray() {
                  txtName = document.getElementById("txtName").value;
                  txtGrade = parseInt(document.getElementById("txtGrade").value);
  
                  alert(txtName + " " + txtGrade);
                  nameData.push(txtName);
                  gradeData.push(txtGrade);
  
                  document.getElementById("txtName").focus();
                  document.getElementById("txtName").value = "";
                  document.getElementById("txtGrade").value = "";
  
  
              }
  
              function displayContent() {
  
                  for (var i = 0; i &lt; nameData.length; i++) {
  
                   //document.write("" + nameData[i] + " ," + gradeData[i] + "&lt;br&gt;");
  
                     if (gradeData &gt;= 90) {
  
                          document.write( "" + nameData[i] + "A");
                      }
                      else if (gradeData &gt;= 80) {
  
                          document.write("" + nameData[i] + "B");
                      }
                      else if (gradeData &gt;= 70) {
                          document.write("" + nameData[i] + "C");
                      }
                      else if (gradeData &gt;= 60) {
                          document.write("" + nameData[i] + "D");
                      }
                      else {
                          document.write("" + nameData[i] + "F");
                      }
  
                  }
  
                  }
  
  
  
          &lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body onload="showPrompt()"&gt;
      &lt;h2&gt;Compute Average Grades&lt;/h2&gt;
  
  
  
      &lt;div id="content"&gt;
      &lt;p&gt;Enter names and grades into a tow-dimensional array (and array of two arrays)
              using text boxes for input and two buttons; one to "Add" input to the arrays
              and one to calculate the average grade and "Display" the information in the arrays.
      &lt;/p&gt;
      &lt;p&gt;
          &lt;label for="txtName"&gt;Student Name:&lt;/label&gt;
          &lt;input type="text" id="txtName" value=""&gt;
              &lt;br&gt;&lt;br&gt;
          &lt;label for="txtGrade"&gt;Grade:&lt;/label&gt;
          &lt;input type="text" id="txtGrade" value=""&gt;
              &lt;br&gt;&lt;br clear: left&gt;
      &lt;/p&gt;
      &lt;div style="text-align:center"&gt;
      &lt;input type="button" class = "btnClass" value="Add" onclick="addToArray()"&gt;&amp;nbsp;&amp;nbsp;
      &lt;input type="button" class = "btnClass" value="Display" onclick="displayContent()"&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>