Using “data.item.artists[0].name” to name other artists, spotify

问题内容:

After searching the internet for a web based now playing viewer I found this one: https://codepen.io/jmperez/pen/MmwObE
It works brilliantly but I wish to add the ability to see any other artists featured on a song.

I tried using the already inputted code <div class="now-playing__artist">${data.item.artists[0].name} </div>
so that it looked like this: <div class="now-playing__artist">${data.item.artists[0].name}, ${data.item.artists[1].name} </div> This worked for any songs that had a second artist but if a song only had 1 artist it would break and not display anything.

Would their be a way have the other artist displayed while also being able to one display 1 without it breaking?

Sorry if it is vague, any questions just ask!

Original code found here: https://codepen.io/jmperez/pen/MmwObE

问题评论:

原文地址:

https://stackoverflow.com/questions/47756673/using-data-item-artists0-name-to-name-other-artists-spotify

添加评论