I have a file with a function that takes all the records of a table, as below.
window.lerTabelaListas=function()
{
lista=new Array();
db.transaction(function (tx)
{
tx.executeSql('SELECT * FROM listas',[],function (tx, results)
{
var len= results.rows.length, i;
for(i=0; i<len; i++)
{
var nome=results.rows.item(i).nome
var id=results.rows.item(i).idLista
lista.push(nome,id)
}
});
});
return lista;
}
As I call this function I can not get any return, I can not, for example, make a foreach
to extract these values. By console , however, it returns:
Array(32)
0
:
"lista de: 2/3/2018"
1
:
1
2
:
"lista básica "
I need some help, as I'm a beginner in JavaScript .