title: Never ending for loop javascript
body: <p>Why is this loop never-ending? Every section may or may not have subsections, which are the same class as a section.The for statement is working very strangely. It goes straight back up to <code>list.append('&lt;label class="heading"&gt;' + theSection.description + '&lt;/label&gt;&lt;br/&gt;&lt;hr&gt;&lt;br/&gt;');</code> all the time. If there are no subsections it should not do that. </p>
  
  <pre><code>function createAssessmentSectionFormHTML(section) {
      var list = $('#assessmentSectionForm' + platform);
       appendSection(section, list);
  }
  
  function appendSection(theSection, list) {
      list.append('&lt;label class="heading"&gt;' + theSection.description + '&lt;/label&gt;&lt;br/&gt;&lt;hr&gt;&lt;br/&gt;');
      appendSectionQuestions(theSection, list);
      if (theSection.allSubSections) {
          for (x = 0; x &lt; theSection.allSubSections.length; x++) {
              var theSectionA = theSection.allSubSections[x];
              appendSection(theSectionA, list);
          }
          return;
      }
  }
  </code></pre>