title: javascript - variable scope - local and global
body: <p>i am developing a node.js applicaton where i am using the node-mysql connector. This is how i am retrieving the data:</p>
  
  <pre><code>var queryString2 = "SELECT * FROM table WHERE domain = 'xyz';"
  conn.query(queryString2, function (error,results2)
      {
          if(error)
              {
                  throw error;
              }
              else
          {
              abc = results2;
              console.log(abc);  //this works
          }
      }
  )
  
  console.log(abc); //this does not work
  </code></pre>
  
  <p>My question is how do i access the value of abc outside of the conn.query function?</p>