[Twitch.tv API] wait for all fetch to finish inside for loop

I’m using a for loop to iterate through the users array and call a fetch for each user. Then i output the data i want to an array. I want to work with this array outside the loop (so i can sort users by online, etc.) but everytime the api fetches are still running asynchronously (even when i tried using ajax and setting async to false?). Can someone please help me figure out how to wait for the all the calls in the loop to finish before executing the rest of the code outside the loop?

Thanks in advance. I’ve been on google for hours now trying to figure it out.

Thanks in advance :smiley:

I think this might be of help:




You are a saviour. Thankyou so much! :smiley: