Twitch TV API - Help with displaying the data of each streamer [CLOSED]

Twitch TV API - Help with displaying the data of each streamer [CLOSED]
0

#1

Hello Guys,

I have just started working with the Twitch TV API project but I am finding it difficult to display all the ‘streamers’. I know I am missing something in this code, but is my way of thinking correct?
Could anyone please help me?



Simon


#2

You currently have:

        output = '';
        output += `
                <a href="${obj.name}" target="_blank">
                  <h3>${obj.name}</h3>
                  <img width="50" src="${obj.logo}">
                  <p>${obj.status}</p>
                </a>
              `;      
      document.querySelector("#output").innerHTML = output;   

inside the forEach, so you are only going to get the last object each time, because you set output to a blank string before you concatenate the current object. You need to move the output = ‘’; to before the forEach.


#3

Thanks @randelldawson, I can’t avoid making silly mistakes when I code. :expressionless:


#4

I find it helpful to use console.log statements at various part of my code when I do not gets the results I expect.


#5

Helpful tip, in fact I tried different things but it was midnight and I was a bit tired.

Thanks!


#6

@randelldawson Could I kindly ask you to check what’s wrong with my code?