I am trying to take some some objects from an original object into an array variable.
console.log("news len", news["articles"].length); // this comes out to 9
for(var a in news["articles"]) {
var results = [];
results.push({
title:news["articles"][a]["title"],
subtitle: news["articles"][a]["description"],
item_url:news["articles"][a]["title"],
image_url:news["articles"][a]["urlToImage"],
});
}
console.log("results len",results.length); //only contains one entry
Is there another way to accomplish this, and if not what am I doing wrong?
Using Node js if that helps any.
for, as well.