title: How to filter an array of objects by their first letter in react/javascript
body: <p>I am fairly new to React and javascript environment so some of the syntax and errors don't make sense to me. I have tried using the filter function something like this but gives me an error of <em>undefined is not an object.</em></p>
  
  <pre><code>const temp = example.filter(x =&gt; x.includes('A'))
  </code></pre>
  
  <p><strong>Example:</strong></p>
  
  <pre><code>data = [{id: 1, type: Pizza}, {id: 2, type: Taco}, {id: 3, type: Pasta}, {id: 4, type: Sandwich}, {id: 5, type: Pumpkin Pie}]
  </code></pre>
  
  <p><strong>Output:</strong></p>
  
  <pre><code>temp = [{id: 1, type: Pizza}, {id: 3, type: Pasta}, {id: 5, type: Pumpkin Pie}]
  </code></pre>