title: Can't pass this error with Vanilla JS: Cannot read property 'map' of undefined
body: <p>I'm trying to use OMDb API, and I keep getting this error. Followed all the steps from <a href="https://www.youtube.com/watch?v=mWg2udweauY&amp;feature=emb_logo" rel="nofollow noreferrer">this</a> YT video and I can't find the answer. It worked before I changed the code to declare moviesection() function outside of the createMovieContainer() . Here is my code:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>let movieSearchable = document.querySelector('.movies-searchable')
  let buttonElement = document.querySelector('#search');
  const url = " http://www.omdbapi.com/?i=tt3896198&amp;apikey=45ddf1ee&amp;s=";
  const posterURL = "http://img.omdbapi.com/?apikey=45ddf1ee&amp;";
  const apiKey = "45ddf1ee";
  
  function movieSection(movies) {
    return movies.map((movie) =&gt; {
      return `
      &lt;img src=${movie.Poster} data-movie-id=${movie.Title}/&gt;
      `
    });
  }
  
  function createMovieContainer(movies) {
    let movieElement = document.createElement('div');
    movieElement.setAttribute('class', 'movie');
    let movieTemplate = `&lt;section class="section"&gt;
    ${movieSection(movies)}
    &lt;/section&gt;
    &lt;div class="content"&gt;
        &lt;p id="content-close"&gt;
            X
        &lt;/p&gt;
    &lt;/div&gt;
    `;
    movieElement.innerHtml = movieTemplate;
    return movieElement;
  }
  
  buttonElement.onclick = function(event) {
    let value = form.value;
    let newUrl = url + value;
    event.preventDefault();
    fetch(newUrl)
      .then((res) =&gt; res.json())
      .then((data) =&gt; {
        let movies = data.results;
        let movieBlock = createMovieContainer(movies);
        movieSearchable.appendChild(movieBlock);
      })
      .catch((err) =&gt; {
        console.log('Error: ', err);
      })
  }</code></pre>
  </div>
  </div>
  </p>