title: How i can return value after http request?
body: <pre><code>var content = 'now - not content';
  
  const getHtmlCode = function(){
    request(url, function(req, resp, body){
      content = body;
    });
    return content;
  };
  
  console.log(getHtmlCode()); // &gt;&gt; now - not content
  </code></pre>
  
  <p>In console i can see <strong>/now - not content/</strong> because request to site takes 2-3 second.</p>
  
  <p><strong>Bad solution:</strong> i can add setTimeout on return, but this is very bad way.</p>
  
  <p><em>How i can wait before return content ?</em></p>