title: How exactly does eval work with nodejs?
body: <p>Let's say I do:</p>
  
  <pre><code>eval(
   db_config = {
                          host: 'localhost',
                          user: 'root',
                          database: 'forum',
                          password: 'test'
                      }
  );
  
   var gamefunctions = require('gamefunctions.js');
  </code></pre>
  
  <p>I can use <code>db_config</code> anywhere inside <code>gamefunctions.js</code> without having to pass it through a parameter. That's pretty neat. But, is this bad practice?</p>
  
  <p>Reason I ask this is because if I do:</p>
  
  <pre><code> var db_config = {
                          host: 'localhost',
                          user: 'root',
                          database: 'forum',
                          password: 'test'
                      }
  
  
   var gamefunctions = require('gamefunctions.js');
  </code></pre>
  
  <p><code>db_config</code> becomes undefined anytime I use it in <code>gamefunctions.js</code>. And I would have to pass it through a parameter on each different function which just seems like <code>evaling</code> it first would save time and code, any downside to this?</p>
  
  <p>Does <code>eval</code> basically just define the variables in a global scope for you, so they can be used in any file in nodejs?</p>