title: Conditional filtering array with map JavaScript
body: <p>I'm trying to get a new array of tracks that have the same genre music id that genreFilter.</p>
  <p>So if genreFilter is 12 I need the new array have tracks with genre music id = 12. But the list of genres is other array so I think I need iterate it too and then return the track.</p>
  <p>I'm doing the next</p>
  <pre class="lang-js prettyprint-override"><code>const list = tracks
        .map((track) =&gt;
          track.primary_genres.music_genre_list.filter((genre) =&gt; {
            if (
              genre.music_genre &amp;&amp;
              genre.music_genre.music_genre_id === genreFilter
            ) {
              return track;
            }
          })
        );
  </code></pre>
  <p>But this only return genres which is obtained by filter function and doesn't return the track.</p>