Twitch Tv Project!

Hello guys, i am doing the twitch tv project, but can i ask you how to assign the values of the array into the api variables? Here is my code until now and what i am trying to do:


const twitchChannels = ["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx", "RobotCaleb", "noobs2ninjas"]

var api1 = "" + twitchChannels[i]
var api2 = "" + twitchChannels[i]
var api3 = "" + twitchChannels[i]

$.getJSON(api1, function(data1){
    for (i = 0; i < twitchChannels.length; i++){

})//json1 end


You misplaced your for loop. Your $.getJSON call should be inside for loop, not other way around.

You need to iterate over your twitchChannels array. So first, get rid of + twitchChannels[i] part from all of your api1, api2 and api3.

Then run a loop like

for(var i=0; i < twitchChannels.length;i++){
  $.getJSON(api1 + twitchChannels[i], function(data1){
1 Like

i tried this, but it doesnt respond my calls to test it, i dont know if it sth wrong with the api or not :confused: this works in code pen but in my local project not!

now it works, ill try it this way with get json, thank u for thing

Can i ask you one more question? i want to put the icons in the side as a column under logo but im not figuring it out! can u give me a tip?

Thanks, ill try to finish the project tomorrow, you have been a great help :slight_smile:

1 Like

hi again, i made this for on this but want to make the icons and the descriptions to stay inline with each other and also the status check is always offline, i think the if statement is ok, can you take a look please?