Good people, I have this function that I use to analyze some texts, the issue is that I need to include the data in an array, I do this within the function using data, which brings this function, but then the variable 'sentiments' is empty, and I can not use it outside the function, what would be the way to get sentiments, the push is made and arrive with the results to the callback?
for(var i=0; i<texts.length; i++){
ibmWatson.analize(texts[i], function (error, data)
{
sentiments.push(data.result);
});
}
callback(null, sentiments);