title: Uncaught TypeError: Cannot read properties of undefined (reading 'Hobbies')
body: <p>I am running into an interesting issue that is throwing me for a loop. I am doing a Sharepoint RestAPI call that returns data correctly, when I run a for loop over the data it builds out the html but still tosses the error that I used as the title. Code is below. If I console log each loop it will return the value. The HTML also works fine. The issue is that error still comes up.</p>
  <pre><code>function getSlideData() {
      var query = &quot;$expand=AttachmentFiles&amp;$select=Title,Team,State,Location,Hobbies,Favorite,Askme,GreatPlace,imageFact,ImageText,Attachments,AttachmentFiles&amp;$expand=AttachmentFiles&amp;$top=1000&amp;$orderby=Created desc&amp;$filter=Display eq 'Active'&quot;;
      var svcUrl = SITE_URL + &quot;_api/web/lists/getbytitle('&quot;+LIST_NAME+&quot;')/items?&quot;+query;
      var employeeData;
  
      $.ajax({
          url: svcUrl,
          type: &quot;GET&quot;,
          headers: { &quot;Accept&quot;: &quot;application/json; odata=verbose&quot; },
          async: false,
          success: function (data) {
              employeeData = data.d.results;
          },
          error: function (xhr) {
              alert(&quot;Can't get list items.&quot;, xhr.status + &quot;: &quot; + xhr.statusText); 
          }
      });
  
      return employeeData;
  }
  
  function buildSlides() {
      var slideData = getSlideData();
      var sliderWrapper = $('#slider-wrapper');
      var sliderWrapperContent = &quot;&quot;;
  
      for(i=0;i&lt;=slideData.length;i++) {
          sliderWrapperContent += '&lt;div&gt;&lt;h2&gt;'+slideData[i].Hobbies+'&lt;/h2&gt;&lt;/div&gt;';
          sliderWrapper.html(sliderWrapperContent);
      }
  }
  </code></pre>