title: Angular - How to Iterate through an object that some of the keys are undefined
body: <p>So I have <strong>objectA</strong> and <strong>objectB</strong></p>
  <pre><code>objectA {
      0: {name: 'M', date: '2021-10-24'}
      1: {name: 'T', date: '2021-10-25'}
      2: {name: 'W', date: '2021-10-26'}
      3: {name: 'T', date: '2021-10-27'}
      4: {name: 'F', date: '2021-10-28'}
      5: {name: 'S', date: '2021-10-29'}
      6: {name: 'S', date: '2021-10-30'}
  }
  </code></pre>
  <pre><code>
  objectB {
      2021-10-29: [{…}]
      2021-10-30: [{…}, {…}]
  }
  </code></pre>
  <p><strong>objectA</strong> holds all the days in the current week and <strong>objectB</strong> holds all the appointments(building an appointments app) in the current week, so <strong>objectB</strong> can have an appointment every day, having the dates of the appointments as keys or it can have only one, two or even 0 date keys, depending if there are appointments or not. In the above example there is only one appointment on the 29'th and two on the 30'th.</p>
  <p>My problem is that I want to iterate through <strong>objectB</strong> in the HTML(to get some appointment data) by getting the keys(the date strings) from <strong>objectA</strong>. I get this Error and the iteration stops because the key I'm trying to access does not exist.</p>
  <p>ERROR:</p>
  <pre><code>ERROR TypeError: Cannot read properties of undefined (reading '2021-10-24')
  </code></pre>
  <p>This is my HTML:</p>
  <pre><code> &lt;tbody&gt;
       &lt;tr&gt;
           &lt;td *ngFor=&quot;let day of objectA&quot;&gt;
               &lt;div *ngFor=&quot;let app in objectB[day.date]&quot;&gt;
                   &lt;span *ngIf=&quot;app&quot;&gt;{{ app.startTime | date : 'HH:mm' }}&lt;/span&gt;
               &lt;/div&gt;         
           &lt;/td&gt;
       &lt;/tr&gt;
   &lt;/tbody&gt;
  </code></pre>
  <p>So I guess my question is how do I iterate through <strong>objectB</strong> without knowing all its keys, or how to  make the for loop ignore the undefined and just continue to iterate.</p>
  <p>Thanks!</p>