Vue.component( `track-card`, { props: [ `track` ], data: function () { return { popularity_tooltip: `Popularity.\nClick for more information.` } }, template: `
`, computed: { duration: function () { let timestamp = ``; // Converting to seconds let duration = Math.trunc(this.track.duration / 1000); let seconds = duration % 60; // Converting to minutes duration = Math.trunc(duration / 60); let minutes = duration % 60 // Converting to hours duration = Math.trunc(duration / 60); let hours = duration % 24; if (seconds < 10) { seconds = `0${seconds}` }; return `${hours > 0 ? `${hours}:` : ''}${minutes}:${seconds}`; }, artists: function () { let artists = []; for (var artist of this.track.artists) { artists.push( `${artist.name}` ) } return artists.join(`, `) }, } } );