title: How to pass a variable from a Request as the return value of the global function js
body: <p>Hello and thank you in advance. I'm using npm tedious package to interact with a database. I'm also using Meteor.call and methods, for which I need to pass a variable (newdata in the example below) that carries the data taken from the database as the return value of the function "rr", so that I would be able to use the result of the function in the client by a Meteor call.</p>
  
  <pre><code> function rr(){
          var newdata = [];
  
          var ahora = new Request("SELECT * FROM prueba", function (err) {
                  if (err) {
                      console.log("err1");
                  } else {
                  }
              })
              ahora.on('row', function(columns) {
                  columns.forEach(function(column) {
                      newdata.push(column.value);
                         });
                  });
  }
  </code></pre>
  
  <p>I want "newdata" to be the result of the rr function. How can I do that? If I write "return newdata" it's undefined, I can't use await because newdata is not the return value of any function...</p>
  
  <p>Thank you very much.</p>