Javascript object with array

JSON Data

My code so far:

    recentTracks.items.map(item => {
        res.push({
            trackName: item.track.name,
            artistNames: item.track.artists.map(artist=>
                {
                    console.log(artist.name);
                    return // not sure what to do here
                })
        })
    })

res is the object and for each artist.name, I want to push it into the array but I’m not sure how.

Leave a Comment