how to wait until Array is filled (asynchronous)
<p>I have an array which is filled asynchronous and contains 28 items. I want to wait until the array is filled with all items.</p>

<pre><code>function checkIfFinished(){
    return(Results.length &gt;= 28);
}

var isfinished = false;
while(isfinished){
    if(checkIfFinished()){
        returnResults();
        isfinished = true;
    }
    else
        //Wait 100ms 
}
</code></pre>

<p>Well, but in Javascript there is no wait function! I tried it with setTimeout, but I don't know how to insert it... I just get errors with too much recursion and stuff :D</p>

<p>Thank you!</p>
