title: Cant return variable in recursive function javascript
body: <p>HI guys im  creating a Phonegap program that is using a javascript function to return the values colected in the database , the problem is that i cant return the values becouse they are in a recursive function , everytime a call the main function it doesnt retusn anything</p>
  
  <p>the code is:</p>
  
  <pre><code>function exporta_imoveis(){
    var db = window.openDatabase("Ithomes", "1.0", "Cordova Demo", 200000);
    db.transaction(function coletandovisitas(tx){
      alert('Coletando imoveis no BD local ');
      tx.executeSql('SELECT * FROM IMOVEIS', [], function percorrendolinhas(tx, results){
        var len = results.rows.length;
        var array_retorno = new Array();
        for (var i=0; i&lt;len; i++){
          array_retorno[i] = results.rows.item(i);
        }
        return array_retorno;
      }, function err(){ alert('erro ao coletar') } );            
    },function erro(){ alert('erro ao coletar dados dos imoveis') }, function acerto(){ alert('Dados dos imoveis coletadas com sucesso')} );
  }
  </code></pre>
  
  <p>I need to get the value of <code>array_retorno</code> variable, please help </p>