Use function to create a new scope where the value can be container in the closure.
var res = {a:'hello', b:'howdy'};
var calls = [];
for (var key in res) {
calls.push(
(function(k) {
return function (cb) {
console.log('say: ' + res[k] + ' to ' + cb);
}
})(key)
);
}
calls[0]('you');
calls[1]('me');
prints:
say: hello to you
say: howdy to me