I call an async function that doesn't 'belong' to me inside a loop. I need to get retrieve a variable inside the 'then' function. Here is how I do it:
    for(var int = 0; int < attachments.length; int++) {
        dp.getAttachment(attachments[int]).then(function (response) {
            console.log(int);
        });
    }
How can I send the int so I can get it inside the function?
 
     
     
    