Twitch ForEach not returning data for some users in array

Twitch ForEach not returning data for some users in array
0

#1

Hey everyone, I am working on the twitch api application, and I am nearly completed with getting the data in a format to output to the DOM, but I am having an issue. I am using forEach to iterate through individual users in my users array. Then returning data from both the channels and streams objects from the twitch API for those users, then taking those 2 data sets, and combining them into a single data set which I will then use to update the display in the application. I haven’t gotten to updating the view yet, right now I am just using the console to make sure all the data is there. When I run my application and look at the console, most of data is there, but there are a few users which look like they get skipped, and I am not sure why this is. It looks like the users who get skipped are the ones who are online, and currently streaming. Is there something wrong with the way I have my streamer function set up to handle online users? Thanks in advance.

Codepen link: http://codepen.io/InfiniteSet/pen/oZxPVy?editors=1011


#2

Hi, I found a mistake in a treatment of response. So, in JS, line 57:

	if(sData.stream === null){
		streamerObj.status = "Offline";
	} else {
		streamerObj.status = sData.stream.game + ": " + sData.channel.status;
	}

sData.channel.status doesn’t exist, replace it to cData.status


#3

Thank you so much! After looking at the data schema coming back from twitch, the data element I was trying to grab was cData.stream.channel.status (which is the same as cData.status). I didn’t see that channel was nested under stream. Thanks again!