title: Unable to access a variable outside a async function
body: <p>How to access the results variable outside of the function.</p>
  
  <pre><code>
  con.query(
      "SELECT * FROM table WHERE particulars = 'data'",
      (error, results) =&gt; {
        if (error) {
          return console.error(error.message);
        }
        console.log(results);
      }
    );
  
  </code></pre>
  
  <p>Console.log is working fine inside the function but when I return the results variable to use it outside the function I get an undefined variable. I know I should use something like an async function but I can't figure out how to use it in this case.</p>
  
  <p>Thank you in advance.</p>