for (var i = 0; i < somearray.length; i++) { myclass.foo({\'arg1\':somearray[i][0]}, function() { console.log(somearray[i][0]); }); }
All the functions/methods can be used as callbacks only. When you call the callback function you pass variables to it.
var myclass = { foo: function(params, callback){ // do some stuff callback(variable1, variable1, variableN); } }