How do you access content from a Promise that is in a then() function, accessing it in the next then() function.
My question is roughly explained through the following code.
someRandomPromiseFunction().then(function(theArray) {
var newProm = _.map(theArray, function(arrayItem) {
return new Promise(function(resolve, reject) {
resolve(arrayItem);
});
}
Promise.all(newProm).then(function(theArray) {
return theArray; // How do I access this in the next then() function
}).catch(function(err) {
return err;
});
}).then(function(theArray) {
console.log(theArray); // I need to access theArray from the Promise.all HERE
});