Using a function to make a http request with NodeJS. Passing a previously defined array as argument when running the function but the array is empty when console logged.
var testList = []:
var httpQuery = function(ep, q, lst) {
  ep.selectQuery(q).then(function (res) {
       return res.json()
  }).then(function (result) {
        lst = result.results.bindings;
  }).catch(function (err) {
      console.error(err)
  })
};
httpQuery(endpoint, testq, testList);
How can I get the data from the function callback in to my previously defined array and use it outside of the function?
 
    