Jquery queue issue
<p>I have the following</p>

<pre><code>function test(){
    var top = numGanadores + numSuplentes;
    var cuponesList = itemsFromAnArray;
    for (var g = 0; g &lt; numGanadores; g++) {
        $(cuponesList[g]).delay(2000 * g).queue(function (next) {
            addNewRow('ganadores', this.parCedula, this.parNombre, this.cupNro, this.cupNroTarjeta, this.cupClaseTarjeta, this.parMonto, this.cupMonto);
            next();
        });
    }

    for (var s = numGanadores; s &lt; top; s++) {
        $(cuponesList[s]).delay(2000 * s).queue(function (next) {
            addNewRow('suplentes', this.parCedula, this.parNombre, this.cupNro, this.cupNroTarjeta, this.cupClaseTarjeta, this.parMonto, this.cupMonto);
            next();
        });
    }

    alert('end');
}
</code></pre>

<p>I want to show an alert when the 2 queue functions ends, at this moment the <code>alert()</code> shows when I execute the function <code>test()</code> then execute the queue.</p>

<p>Is there any way to get best performance on this funtion?</p>
