I am still a beginner in JS here i am trying to pass the value of x to y tried y=x but didnt work y is returned as undefined and x is returned as an array of values
exports.Get_info = function (name) {
   var y;
   db.query(query, params, function (err, results) {
      if (err) {  
         console.log('Error');
         throw err;
      } 
      var x = results.map(function (result) {
         data1 = result['name'];
         return data1;
      });
      console.log("x = " + x);
      y = x;
      return x;
   });
   console.log("y = " + y)
   return y;
}
 
     
    