I can't seem to reach my object variables, I'm probably just doing a dummy mistake somewhere. A console.log of my array of objects (pResult) look like this, first object expanded but they all look alike:
[Object, Object, Object, Object, Object, Object, Object, Object, Object]
0: Object
depTime: "2014-12-04 18:35"
destination: "Norsesund station"
nr: "562"
operator: "Västtrafik"
typText: "Buss"
__proto__: Object
1: Object
2: Object
3: Object
4: Object
5: Object
6: Object
7: Object
8: Object
length: 9
__proto__: Array[0]
I try to do this...
for (var i = 0; i <= pResult.length; i++) {
var html = html + '<tr>';
var html = html + '<td>';
var html = html + pResult[i].depTime;
var html = html + '</td>';
var html = html + '</tr>';
}
...but get hit with this error:
Uncaught TypeError: Cannot read property 'depTime' of undefined
pResult.depTimeis defined, butpResult[i].depTimeis not. Am I missing something?[json]tag would be appropriate.)