OKAYSO, I'm working with some JSON data and formatting it into the DOM, and I'm trying to avoid stuff that looks like this...
var image1 = content.list.story[1].image[0].crop[1].src;
var image2 = content.list.story[1].image[0].crop[1].src;
var image3 = content.list.story[2].image[0].crop[1].src;
var image4 = content.list.story[3].image[0].crop[1].src;
To avoid that, I'm using the following for loop
var count ;
for(count = 0; count < 1; count++){
console.log("content.list.story["+[count]+"].image[0].crop[1].src");
};
That code prints
content.list.story[0].image[0].crop[1].src
Exactly as it should. However, when I format it to print the actual resource, as such...
var count ;
for(count = 0; count < 1; count++){
console.log(content.list.story['+[count]+'].image[0].crop[1].src);
};
...it returns undefined.
Any idea what I'm screwing up here?
content.list.story[count].image[0].crop[1].src