title: Why am I getting 'cannot read property 'filter' of undefined' when the array being filtered contains JSON data?
body: <p>The following code</p>
  
  <pre><code>const endpoint = 'https://raw.githubusercontent.com/Hipo/university-domains-list/master/world_universities_and_domains.json';
  const universities = [];
  
  fetch(endpoint)
      .then(results =&gt; results.json())
  
      .then(data =&gt; universities.push(...data));
  
  console.log(universities);
  
  function findMatches(wordToMatch, universities) {
      return universities.filter(uni =&gt; {
          const regex = new RegExp(wordToMatch, 'gi');
          return uni.name.match(regex)
      })
  }
  
  export default findMatches;
  </code></pre>
  
  <p>returns the error below</p>
  
  <blockquote>
    <p>'Uncaught TypeError: Cannot read property 'filter' of undefined'</p>
  </blockquote>
  
  <p>I can log the data using console.log(universities). So why can't I filter through it? FYI the data is an array of objects. Any help is massivaly appreciated. Thank you.</p>