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