Looking for a more efficient way to organize my code using loops
let tmpD = [];
let tmpS = [[], [], []];
for(let i = 0; i < tmpD.length; i++) {
signed = doctors.doc(tmpD[i].key).collection('schedule').get();
signed.then(function(ss){
ss.forEach(function(schedule){
tmpS[i].push(schedule.data());
});
console.log(tmpS[i]);
});
}
I attempted to use a for loop above the first signed statement and push data accordingly, but ended up with all data in a single array. I also tried pushing the data to tmpS[i] directly, resulting in an error.