title: variable scope in d3 javascript
body: <p>I want to get data in global variable by using the following code:</p>
  
  <pre><code>var data;
  d3.json ( "file.json" , function(json) {
    data = json;
    console.log(data); //defined
  });
  console.log(data); //undefined
  </code></pre>
  
  <p>But the problem is that i just have data variable defined in  d3.json function but out it is undefined.
  how can I solve this issue?</p>
  
  <p>Thanks</p>