title: Why is my Not JS code giving me this error?
body: <p>Hello i'm new in node js and I definitly need help </p>
  <p>Here i need to have access to the result query for a for loop after this but my variable firstresult don't change outside the query loop.</p>
  <p>How can i do it ?</p>
  <pre><code>            db.query(&quot;SELECT * FROM film&quot;, function (err, result) {
                if (err) throw err;
  
                  firstresult=result
              });
                  console.log(firstresult) ///AFFICHE undefined```
  </code></pre>