title: Javascript arrow function is not allowing to use outer variable
body: <p>I am trying to get data from an API. If api call is returning more pages then I am making multiple calls. So, I did something as below. Though, it's printing data but not adding it to <code>Title</code> array. It's just getting the first page data but when I am trying to get more data to make different GET request it's not letting me do it. If anyone know the reason please help.</p>
  
  <pre><code>const axios = require("axios");
  
  let pageNumber = 1;
  let title = [];
  
  let valueToSearch = 'love'
  let url = `https://jsonmock.hackerrank.com/api/movies/search/?Title=${valueToSearch}`;
  let pageURL = `https://jsonmock.hackerrank.com/api/movies/search/?Title=love&amp;page`;
  
  const getMovieName = async url =&gt; {
      try{
          const response = await axios.get(url);
          const data = response.data;
  
          let totalPages = data.total_pages;
  
          let mainData = data.data;
  
          mainData.forEach(element =&gt; {
              let movieName = element.Title;
              title.push(movieName);
          });
  
          for(var i=2; i &lt;= totalPages; i++){
  
              let newUrl = `${pageURL}=${i}`;
  
              const getMovieNameInner = async url =&gt; {
                  console.log(url);
                  try{
                      const response = await axios.get(newUrl);
                      const data = response.data;
                      let mainData = data.data;
  
                      let perPage = data.per_page;
  
                      mainData.forEach(element =&gt; {
                          let movieName = element.Title;
                          console.log(`printing inside ${movieName}`);
                          title.push(movieName);
                      });
  
                  }catch (error) {
                      console.log(error);
                  }
              }
  
              getMovieNameInner(newUrl);
              console.log(title.length);
          }
  
          console.log(title);
  
      }catch (error) {
          console.log(error);
      }
  }
  
  getMovieName(url);
  </code></pre>