So my knowledge on this is really sketchy and I've just started with Javascript so go easy please.

I've been trying to read up on this but my head can't quite understand whats going on.

This is the algorithm

FOR LOOP (i)
{
CALL FUNCTION (with param i) WHICH IS ASYNCHRONOUS {
PUSH TO ARRAY
}
}

The issue here is obvious, the push to array doesn't happen until its completed the full loop cycle, by which the data is lost.

The function call seems like it must be asynchronous and this I can't change.
How can i force it to push to the array before getting the next i value.

If you need more concrete code let me know