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