How to return single promise after for loop (which produces a promise on every iteration) is complete?
I have a problem with my promise return code, I have a function getTagQuotes which contains a for loop which can make multiple calls an API to return data into an array. How my code for this begins below: // If there are tags, then wait for promise here: if (tags.length > 0) { // Setting promise var to getTagQuotes: var promise = getTagQuotes(tags).then(function() { console.log('promise =',promise); // This array should contain 1-3 tags: console.log('tweetArrayObjsContainer =',tweetArrayObjsContainer); // Loop through to push array objects into chartObj: for (var i=0; i<tweetArrayObjsContainer