(SOLVED) Twitch - Nested getJSON issue?

I’m seeing a strange issue where it seems like my api calls seem to get called out of order. I set up a loop and make an initial call to see if a streamer is online, I then set up an if statement with a path for streamers offline, and another path for streamers online. The offline path makes an another API call using a nested getJSON method. The weird thing is that it seems like the offline getJSON method only gets called after all the online api calls are mad.

Is nesting the getJSON statements causing issues? I can’t quite figure out what the problem is.

Wow, one keyword solves all my issues. Thank you.

So the for loop is finishing even before the nested JSON is called even once?

Just so I understand what is happening with the “let” keyword - it saves the “i” variable value in memory for each nested getJSON request in the loop? Whereas the “var” keyword makes it so the nested getJSON request uses whatever the value is at the time it’s ready to go?

Bonus question:

Why are my rows out of order compared to my array order? Is this because the api request takes a different amount of time for each streamer in the array?