score:1

Accepted answer

Only through the parent scope:

var myd = data.map(function(d){
    q.defer(d3.csv,'https://***/'+d+'.csv', d); 
    return d
})

q.awaitAll(function(error, result, d) {
    if (error) throw error;
    //how to get the d value here?
    console.log(myd) // myd contains all the d from your map.
});

But since in the data.map() call, you are already using all of data (data is bound to d inside the mapper function):

q.awaitAll(function(error, result, d) {
    if (error) throw error;
    //how to get the d value here?
    console.log(data) // this is the same `data` from the `data.map()`
});

EDIT: the original question was not clear. The OP apparently wants to remap the results back to a d value:

q.awaitAll(function(error, result) {
    if (error) throw error;
    //how to get the d value here?
    result.map(function(res, idx) {
        console.log("original d:" + data[idx].toString())
    }
});

awaitAll documentation: https://github.com/d3/d3-queue#queue_awaitAll

Some additional reading material:

https://scotch.io/tutorials/understanding-scope-in-javascript

https://toddmotto.com/everything-you-wanted-to-know-about-javascript-scope/


More Query from same tag