title: Mutable variable is accessible from closure
body: <p>I have the following code:</p>
  
  <pre><code>for (var i = 0; i &lt; data.length; i++) {
          var file = data[i];
          $.getJSON("/types/" + file, function(json) {
              if (json[0] !== undefined) {
                  console.log(json[0] + file);
              }
          });
      }
  </code></pre>
  
  <p>But my editor is saying "Mutable variable is accessible from closure". I've tried to change <code>function(json) {</code> to <code>function(json, file) {</code>, but this don't work because this is a default function of jquery.</p>
  
  <p>I hope you can help my fixing the problem.</p>