I know iteration has been covered before - I'm usually pretty ok with it but struggling this time.
I have the following information I'm trying to loop through:
Object { leaving: object { all: array[10] } }
I can quite easily return a single result by returning:
var html = '<p>' + news.leaving.all[0].departure_time + '</p>';
But when I try to loop:
var html = "";
var i;
for (i = 0; i < news.length; i++) {
html +=
'<p>' + news[i].leaving.all.departure_time '</p>';
}
I get nothing…
Any help with this will be great.
Thanks