0
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);
        });

In console, I see that for-in loop returns two more lines and all elements are undefined. I use Web Sql API here. enter image description here

Does anybody know why this will happen?

6
  • Please put your code in your question as text instead of linking to a tiny screenshot. Commented Mar 3, 2017 at 19:28
  • How can I edit it? I don't see any button Commented Mar 3, 2017 at 19:29
  • It should be under your question’s tags. Commented Mar 3, 2017 at 19:31
  • The part of the linked answer that applies to your case here is likely “In addition, if any monkey patches or shims are put into place on the array object, they can show up here.”, and you can confirm that by logging numb each time around the loop. Commented Mar 3, 2017 at 19:42
  • got it, thanks, though don't fully understand :P Commented Mar 3, 2017 at 19:57

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.