var fetchResults = tx.executeSql("SELECT * FROM sessions WHERE sessions.dayid=1 ORDER BY sessions.starttime ASC", [],
function(tx, data){
processorFunc(data);
var contxt = "";
for (var numb = 0; numb < data.rows.length; numb++) {
contxt += data.rows[numb].title + "=" + data.rows[numb].startTime + "=" +
data.rows[numb].endtime + "=" + data.rows[numb].type + "\n";
}
console.log(contxt);
contxt = "";
for (var numb in data.rows) {
contxt += data.rows[numb].title + "=" + data.rows[numb].startTime + "=" +
data.rows[numb].endtime + "=" + data.rows[numb].type + "\n";
}
console.log(contxt);
});
在控制台中,我看到for-in循环返回两行,并且所有元素都是未定义的。我在这里使用Web Sql API。 enter image description here
有人知道为什么会这样吗?