我试图从查询中返回值,但是当我提醒我的 var 时,它说它未定义。下面是我的代码
function countRows(){
db.transaction(function (tx){
tx.executeSql('SELECT id FROM Courses', [], function (tx, results) {
var len = results.rows.length;
return len;
});
});
}
var test = countRows();
alert(test);