i need help !!
https://wind-bow.glitch.me/twitch-api/streams/
i wrote if stream !== null return online else return offline and even if stream is not null it will return offline.
Hey. I’ll give you an hint on this one. I’ve added a bunch of console.log
in your code; replace the first part of your forEach
with the one shown below (I changed nothing, just added the console.log(s)). Then, see if you can understand what’s wrong with your code by looking at what they print out in your console (F12 to open the Dev Tools):
users.forEach(function(user, i){
console.log("%cIteration n."+i, "color:darkgrey");
// Stream online or offline JSON null=offline
stream = urlStream + user;
console.log("stream = urlStream + %c"+user, "color:#842e2e;");
// getting channel info JSON
channel = urlChannel + user;
console.log("channel = urlChannel + %c"+user, "color:#2e4084;");
console.log("%cGetting Channel: ", "color:#2e4084;", channel);
i === users.length-1 ? console.log("%cLoop done!"+" %cBut... wait a minute.", "color:green;", "color:grey;") : '';
$.getJSON(channel, function(data){
console.log("%cGetting Stream: ", "color:#842e2e;", stream);
$.getJSON(stream, function(stat){
1 Like
Thanks dude. that certainly helps alot !!!