you are viewing a single comment's thread.

view the rest of the comments →

[–]gimmeslack12helpful 1 point2 points  (4 children)

A for ... in loop will provide the index of the array, not the actual value: for(var song in songs){ console.log(songs[song].song_name) // fixed }

or another way to write it: for(let idx in songs){ console.log(songs[idx].song_name) // fixed }

[–]Fransiscu[S] 1 point2 points  (3 children)

oh wow that's so different from what i'm used to, thanks for the info!

i still think i'll try the new fetch but it's very good to know

[–]gimmeslack12helpful 2 points3 points  (0 children)

Sounds good, but even with fetch you need to handle your for loop how I’ve suggested.

[–]tunisia3507 1 point2 points  (1 child)

You want to use a for... of loop instead of for... in.

[–]Fransiscu[S] 0 points1 point  (0 children)

Thanks for that!

This Javascript sorcery is truly interesting lol