title: nodejs: Not able to read response from callback function in the main function
body: <p>Noob in nodejs here and still trying to learn how nodejs works. Could you please let me know how can I pass the callback response from &quot;getDatafromCosmosDB&quot; function into a variable in the main function and print those values.</p>
  <p>When I try to assign getDatafromCosmosDB to a variable &quot;respdata&quot; and try to print it, it is not working.</p>
  <pre><code>async function main(params, callback) {
      const logger = Core.Logger('main2', { level: params.LOG_LEVEL || 'info' })
      try {
          logger.info('main action')
          const respdata = getDatafromCosmosDB(function(response){
              console.debug(response)
              return response
          });
           console.debug(respdata)
      } catch (e) {
          console.debug(e)
      }
  }
  
  exports.main = main
  async function getDatafromCosmosDB(callback){
      var query = new azure.TableQuery()
      .top(5)
      tableService.queryEntities('myCosmosTable', query, null, function (error, result, response) {
          if (!error) {
              console.log('success')
              return callback(result.entries)
          }
      });
  }
  </code></pre>