title: Is it best to declare temporary variable inside or outside of a loop?
body: <p>What's the best practice, performance-wise, about temporary variables in loops? Is it better to do something like :</p>
  
  <pre><code>some_array.forEach(function(item) {
    var temp_obj = {};
    // do some operations with temp_obj
  });
  </code></pre>
  
  <p><strong>OR</strong></p>
  
  <pre><code>var temp_obj;
  json.forEach(function(item) {
    temp_obj = {};
    // do some operations with temp_obj
  });
  </code></pre>
  
  <p>I always assumed there was no difference in performance, but every time I use it I'm not sure I'm following the good practices...</p>