0
for(j=0;j<twitchUserArray.length;j++)
        {
          displayALL(twitchUserArray[j]);
        }

    function displayALL(person){
      console.log("Inside displayALL");
      console.log(person);
      console.log(person.logo);

     }

Array[9]

0: Object

game: ""
logo: "http: //static-cdn.jtvnw.net/jtv_user_pictures/freecodecamp-profile_image-f1b681380c0b0380-300x300 .png"
name: "freecodecamp"
status: null
twitchfeed: "http: //www.twitch.tv/freecodecamp"
__proto__: Object

1: Object

game: ""
logo: "http: //static-cdn.jtvnw.net/jtv_user_pictures/storbeck-profile_image-7ab13c2f781b601d-300x300 .jpeg"
name: "storbeck"
status: null
twitchfeed: "http: //www.twitch.tv/storbeck"
__proto__: Object

2: Object

game: ""
logo: null
name: "terakilobyte"
status: null
twitchfeed: "http: //www.twitch.tv/terakilobyte"
__proto__: Object

Can anyone tell me the right syntax to get the values of a key when inside my displayALL function. Each index in that for loop is an object. Console.log(person) shows me the object with all the keys and values when troubleshooting in chrome but I've tried . notation and bracket notation and cannot get anything but undefined

Rawle Juglal
  • 395
  • 4
  • 17

1 Answers1

0

Maybe you should look to see what a person is using typeof in displayALL

   for(j=0;j<twitchUserArray.length;j++)
    {
      displayALL(twitchUserArray[j]);
    }

    function displayALL(person){
      console.log("Inside displayALL");
      console.log(person);
      console.log(typeof person);
 }
Robert Moskal
  • 21,737
  • 8
  • 62
  • 86
  • console.log(typeof person); logs object to me. which is why I'm not sure why I can't use dot notation to get the values. Did you get something different? – Rawle Juglal Dec 18 '15 at 22:41
  • I've done some further console.log testing and the function displayALL is not the issue. for some reason console.log(twitchUserArray) gives me the array of objects like I'd expect. But then if I try to run a that for loop or even just a for loop that console.log(twitchUserArray[j]) it logs to the console empty objects. So I don't know why all the data in the objects is disappearing. – Rawle Juglal Dec 19 '15 at 02:59
  • Yes, your problem is with callbacks and such. You need to pay attention to what happens with your Ajax call. – Robert Moskal Dec 19 '15 at 03:11