All seems to works perfectly except i cant push my value to my array inside the promise all function ?? What am i doing wrong here ?
var reponses = [];
Object.values(thequestion.answers).forEach(item => {
var mars = item.mars;
var getFullName = FirebaseRef.child('/users/' + mars + '/fullName').once('value');
var getAvatar = FirebaseRef.child('/users/' + mars + '/avatar').once('value');
var getDescription = FirebaseRef.child('/users/' + mars + '/description').once('value');
// console.log(queries);
Promise.all([getFullName, getAvatar, getDescription]).then(answer => {
var oneanswer = {
answer: item.answer,
};
reponses.push(oneanswer);
});
console.log('oneanswer', reponses);
});
.push()to make sure your promise is entering the.thenresponseshasn't been populated yet. If you call it just afterpushit should include the new value. Is this the problem?