What is the scope of an array in javascript?
How can I resolve this situation?
var parseXlsx = require('excel');
var arrayURLToSearch = [];
parseXlsx('foo.xlsx', function(err, data) {
if(err) throw err;
for(var i=1; i<2; i++){
arrayURLToSearch[i] = data[i][0];
}
});
console.log(arrayURLToSearch[0]); -> undefined
How can I print the arrayURLToSearch
outside the function?