Twitch Streamers App Problem

Twitch Streamers App Problem
0

#1

I am having trouble with the Twitch App. As of right now, my code is not adding the offline-icon class to offline users. My guess is the problem has something to do with these lines:

if (data.stream == null) {
   $('#' + users[i]).addClass('offline-icon');
}

Here’s a link to my pen: http://codepen.io/Hudson_Taylor11/pen/YpjxKm?editors=0010

Thanks!


#2

I don’t find the code you mention in you pen, only this:

$(document).ready(function() {
  var users = ["freecodecamp", "trymacs"];
  var links = users.map(function(val) {
    $.getJSON('https://wind-bow.gomix.me/twitch-api/streams/' + val, function(data) {
      return data.stream;
    });
  });
  console.log(links);
});

#3

I already changed it. Still having trouble, but I’m trying a new approach. Thanks!