I have a scope problem when populating an array with a function (code of getimages-altbis.js in the picture): array is populated locally to the function, not the global var.
(function() {
var a = [];
function parse() {
const parser = require('rss-url-parser');
parser('https://www.nasa.gov/rss/dyn/lg_image_of_the_day.rss')
.then((data) => photoSet(data));
}
function photoSet(items) {
a.push(items);
};
console.log(a.length);
})();
Any idea on how to populate this array from the parse()?
Thanks.