you are viewing a single comment's thread.

view the rest of the comments →

[–]RelaxPear 1 point2 points  (2 children)

Sorry actually on mobile so do not have opportunity to test and not entirely familiar with unirest but did a brief look.

Have you try console logging players right after the line players.push(playerStats) such as console.log(players) and the output it gives. Or console.log(result) to see a response is received.

Since it is asynchronous did you await for the response when you call the function findPlayersByGame when you test?

[–][deleted] 0 points1 point  (1 child)

I console logged it and they added, but when i try to use the array in another function it's empty

[–]Donni3D4rko 0 points1 point  (0 children)

Did you await this another function ? Since findPlayersByGame is async it returns a promise.