I am having an issue figuring out how to make an array of functions with different parameters. I am using coffeescript and async but I think it is a problem with my understanding of javascript.
I want to create an array of functions with different tasks.
names = ['Jeff', 'Maria', 'Steve']
tasks = []
for name in names
tasks.push (callback)=>
@controller.get_person name, (person) =>
callback(null, person)
async.parallel(tasks, cb)
The problem is that the task is getting called with Steve (always the one that is last in the array) three times. How do I make it so that there is one task per each name?