Twitch TV viewer undefined variable from API

Hi I’m currently trying to do the twitch api viewer project and I’ve got a problem with getting undefined back the when I try and access the game info. When I try and access the object as a whole in the same place it seems to work fine.

$(document).ready(function() {
  for (let i = 0; i < streams.length; i++) {
      "" +
        streams[i] +
      function(x) {
        var test =;
        var streamInfo = '<div class="card card-inverse"><div class="card-block"><h4 class="card-title">' + streams[i] + '</h4>' + isLive(;
          if (live === true){
            streamInfo += '<p>' + test + '</p></div></div>';
            streamInfo += '</div></div>';

My full code is at

Anyone have any ideas why its not working?


Forgot to mention its the value of which is undefined.