How to return an array of objects with a count of how many for each one : <p>How would I go about returning an object that returns the genres of Country, Rock, and Pop with and a count of how many songs are in each genre? The output would look something like:</p>

<p>Country: 4,
Rock: 2,
Pop: 1</p>

<pre><code>const music=  [{
     "title": "Cheats",
     "year": 2018,
     "cast": ["Jane Rhee", "Kacey Brown"],
     "genres": ["Country"]
 }, {
     "title": "Road",
     "year": 2018,
     "cast": ["Jeff Bates", "Alan Walker", "Cindy Bates"],
     "genres": ["Country"]
 }, {
     "title": "Trail Down",
     "year": 2018,
     "cast": ["Ken Clemont"],
     "genres": ["Jazz"]
 }, {
     "title": "Way Down",
     "year": 2018,
     "cast": ["Denzel Harr", "Dan Smith", "Lee Kyle", "Nate Hill"],
     "genres": ["Pop"]
 }, {
     "title": "Fountain",
     "year": 2018,
     "cast": ["Brad Smith", "Rosa King"],
     "genres": ["Rock"]
 }, {
     "title": "Gold Bells",
     "year": 2018,
     "cast": ["Paisley John"],
     "genres": ["Blues"]
 }, {
     "title": "Mountain Curve",
     "year": 2018,
     "cast": ["Michael Johnson"],
     "genres": ["Country"]
 }, {
     "title": "Arabella",
     "year": 2018,
     "cast": [],
     "genres": ["Rock"]
 }, {
     "title": "Curved",
     "year": 2018,
     "cast": ["Brett Shay"],
     "genres": ["Country"]
 }];
</code></pre>

<p>This is my code. I am getting all the genres and no counts.</p>

<pre><code>let songs = []; 

for (var i = 0; i &lt; music.length; i++) {
    songs.push(music[i].genres);
}
    console.log(songs);
</code></pre>
