Firstly, what I’d recommend is that you break down your JS into smaller, niche functions. For example, see my Twitch TV project. One of my functions is called isOnline(), which, you guessed it, returns true if a given streamer is online!
Secondly, onto your question: how to loop over the channels. Well, we need to know which channels we’re looping over, right? In my example, I made an array of my chosen channels (streamers). Next, I made a second array to store data for each channel (streamersData).
Now, we need to get the actual data from Twitch. As you showed in your codepen, you use an ajax call. Although I believe there is a way to make only 1 call for multiple streamers (& improve performance), we’ll use multiple calls for this example.
So, all we have to do is loop over our streamers array, sending 1 ajax for each streamer. If the ajax was successful, we’ll add the streamer data to our streamersData array as well as update the dom. You can loop over them with a for-loop, while-loop, or by making a method call itself.
Once the loop is finished, you should have a full streamersData array and a full list of streamers on your dom.
I hope I answered your question well enough! If you’re still confused, feel free to send me a message or leave a message on this forum!