I am using a JavaScript API of some software. In software there are Solutions and they contain Worklists.

For each Solution I want to list Worklists. 

```
solutions = obtainSolutionsformAPI();
for (i=0,i<solutions.length,i++){
    sol=solutions[i];
    sol.obtainWorklists(callbackFunction);    
}

```

the callbackFunction is called by software and the array of worklists is passed as the argument.

```
function callbackFunction(arrayOfWorkLists){
    for (j=0,j<arrayOfWorkLists.length,j++){
        wl=arrayOfWorkLists[j];
        console.log(wl);
    }
}

```

now in console.log I would like to also print out the `i` variable (the number of solution) together witch each worklist, but how do I get the `i` inside callback function, when I am not the one who is calling it? I suspect I need to modify the callback function each time before I pass it to `sol.obtainWorklists(callbackFunction);` What is the correct way of doing this?

Edit: I do not want the function defintions to be nested (one inside other), because I have multiple nestings like this one and it would be quite unreadable. So I do not want this:

```
sol.obtainWorklists(function callbackFunction(arrayOfWorkLists){...}); 

```