title: How to set variable value in Node.js to get request's the body data
body: <p>I am a newbie in Node.js. I want to store the value of body.xyz in variable A. and want to access from the outside the request like i did in at end of the code. Here is my code, How I can set the variable value. It is showing null value at the end of program.</p>
  
  <pre><code>var request = require('request');
  
  URL = "http://aaaa.com/api.php"
  
  
  // Decleare the variables
  var A = null;
  
  PARAMS_0 = {
      'a':"query"
  }
  
  request.get( {
      url: URL, 
      qs: PARAMS_0
      },
      function(error, response, body) {
          body = JSON.parse( body)
          A = body.xyz 
      }
  );
  console.log( A )
  </code></pre>