title: How to return status code from function in Node.js
body: <p>I have such function:</p>
  
  <pre><code>function getStatusCode(site){
      var options = {
          host: "127.0.0.1",
          port: 8000,
          path: site,
          headers: {
                      Host: site
              }
          };
  
      var status;
  
      http.get(options, function(response) {
          status=response.statusCode;
      });
      return status;
  } 
  </code></pre>
  
  <p>How to return status only when http.get finish work or return null if timeout(e.g. 10 seconds)?</p>