Currently, I am attempting to extract particular values from an array that is nested within another array. Specifically, I am utilizing the Spotify Web API to retrieve the track names from a playlist.
Here is an illustration of how the nested array is structured:
Object
tracks: Object
items: Array [4]
0: Object
track: Object
name
1: Object
track: Object
name
[...]
Within my Ionic/Angular application, I am utilizing the angular-spotify module. I tried to extract the track names using the following code:
Spotify
.getPlaylist('User-ID', 'Playlist-ID')
.then(function (data) {
console.log(data);
arrayLength = data.tracks.items.length;
for (i = 0; i < arrayLength; i++) {
alert(track[i]);
}
});
However, the console is indicating that the name is not defined. Can you please assist me in identifying where I may have made a mistake?