title: NODE.JS how to return data collected using cheerio (keeps returning nothing)
body: <p>I am making a chat bot using Node.js. I use cheerio to scrape information from html and send it to users. I can scrape data and print it threw console but cannot return that information to a variable. Please help.</p>
  
  <p>--Parsing part--
  <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const cheerio = require("cheerio"),
        request = require("request");
  
  const init_url = "https://stu.dje.go.kr/sts_sci_md01_001.do?schulCode=G100000208&amp;schulCrseScCode=4&amp;schulKndScCode=04&amp;schMmealScCode=2";
  
  const MealParser = {};
  
  MealParser.parse = () =&gt; {
    console.log(''+init_url);
    return doRequest(makeURL(),function(err,data){
      console.log(data);
      return data;
    });
  }
  
  function doRequest(url,callback){
    request(url, function(err, resp, html) {
        var list = ["initial array"];
        if (!err){
        const $ = cheerio.load(html);
        $('.tbl_type3 th:contains("중식")').parent().children().each(function () {
          list.push($(this).text());
        });
        return callback(null,list);
      }
    });
  }
  
  function makeURL(){
    var result_url = init_url;
    return result_url;
  }
  
  module.exports = MealParser;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I use function "parse" to return the scrapped information to the main bot which looks like the code down below.</p>
  
  <p>--using the parsed information--
  <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var result = MealParser.parse();</code></pre>
  </div>
  </div>
  </p>