title: access var outside function scope
body: <p>I havethe following code and I'm trying to access <code>selectedBrand</code> var outside so to use it elsewhere in may code</p>
  
  <pre><code>var selectedBrand;
  var brand_sel = d3.select('select')
      .on("change",function(b) {
          selectedBrand = d3.select("#brand").node().value;
      });
  
    console.log(selectedBrand)
  </code></pre>
  
  <p>when I try to consollog <code>selectedBrand</code> I get <code>undefined</code> results.</p>
  
  <p>I try almost everything I understand without success</p>
  
  <p>many thanks for any help</p>